import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EventVO, EventForm, EventQuery } from '@/api/system/event/types';

/**
 * 查询事件列表
 * @param query
 * @returns {*}
 */

export const listEvent = (query) => {
  return request({
    url: '/system/event/list',
    method: 'get',
    params: query
  });
};
export const generateReport = (id) => {
  return request({
    url: `/system/event/generate/${id}`,
    method: 'post'
  });
};
/**
 * 查询事件详细
 * @param id
 */
export const getEvent = (id: string | number): AxiosPromise<EventVO> => {
  return request({
    url: '/system/event/' + id,
    method: 'get'
  });
};

/**
 * 新增事件
 * @param data
 */
export const addEvent = (data: EventForm) => {
  return request({
    url: '/system/event',
    method: 'post',
    data: data
  });
};

/**
 * 修改事件
 * @param data
 */
export const updateEvent = (data: EventForm) => {
  return request({
    url: '/system/event',
    method: 'put',
    data: data
  });
};

/**
 * 删除事件
 * @param id
 */
export const delEvent = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/event/' + id,
    method: 'delete'
  });
};
