import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EventsObjectVO, EventsObjectForm, EventsObjectQuery } from '@/api/sense/eventsObject/types';

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

export const listEventsObject = (query?: EventsObjectQuery): AxiosPromise<EventsObjectVO[]> => {
  return request({
    url: '/dromara/eventsObject/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询事件对象详细
 * @param id
 */
export const getEventsObject = (id: string | number): AxiosPromise<EventsObjectVO> => {
  return request({
    url: '/dromara/eventsObject/' + id,
    method: 'get'
  });
};

/**
 * 新增事件对象
 * @param data
 */
export const addEventsObject = (data: EventsObjectForm) => {
  return request({
    url: '/dromara/eventsObject',
    method: 'post',
    data: data
  });
};

/**
 * 修改事件对象
 * @param data
 */
export const updateEventsObject = (data: EventsObjectForm) => {
  return request({
    url: '/dromara/eventsObject',
    method: 'put',
    data: data
  });
};

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