import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SafetyWeeklyReportForm, SafetyWeeklyReportQuery, SafetyWeeklyReportVO } from '@/api/safety/safetyWeeklyReport/types';

/**
 * 查询安全周报列表
 * @param query
 * @returns {*}
 */

export const listSafetyWeeklyReport = (query?: SafetyWeeklyReportQuery): AxiosPromise<SafetyWeeklyReportVO[]> => {
  return request({
    url: '/safety/safetyWeeklyReport/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询安全周报详细
 * @param id
 */
export const getSafetyWeeklyReport = (id: string | number): AxiosPromise<SafetyWeeklyReportVO> => {
  return request({
    url: '/safety/safetyWeeklyReport/' + id,
    method: 'get'
  });
};

/**
 * 新增安全周报
 * @param data
 */
export const addSafetyWeeklyReport = (data: SafetyWeeklyReportForm) => {
  return request({
    url: '/safety/safetyWeeklyReport',
    method: 'post',
    data: data
  });
};

/**
 * 修改安全周报
 * @param data
 */
export const updateSafetyWeeklyReport = (data: SafetyWeeklyReportForm) => {
  return request({
    url: '/safety/safetyWeeklyReport',
    method: 'put',
    data: data
  });
};

/**
 * 删除安全周报
 * @param id
 */
export const delSafetyWeeklyReport = (id: string | number | Array<string | number>) => {
  return request({
    url: '/safety/safetyWeeklyReport/' + id,
    method: 'delete'
  });
};
