import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VulcAlarmItemsVO, VulcAlarmItemsForm, VulcAlarmItemsQuery } from '@/api/mes/vulcAlarmItems/types';

/**
 * 查询报警项目信息列表
 * @param query
 * @returns {*}
 */

export const listVulcAlarmItems = (query?: VulcAlarmItemsQuery): AxiosPromise<VulcAlarmItemsVO[]> => {
  return request({
    url: '/mes/vulcAlarmItems/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询报警项目信息详细
 * @param alarmItemsId
 */
export const getVulcAlarmItems = (alarmItemsId: string | number): AxiosPromise<VulcAlarmItemsVO> => {
  return request({
    url: '/mes/vulcAlarmItems/' + alarmItemsId,
    method: 'get'
  });
};

/**
 * 新增报警项目信息
 * @param data
 */
export const addVulcAlarmItems = (data: VulcAlarmItemsForm) => {
  return request({
    url: '/mes/vulcAlarmItems',
    method: 'post',
    data: data
  });
};

/**
 * 修改报警项目信息
 * @param data
 */
export const updateVulcAlarmItems = (data: VulcAlarmItemsForm) => {
  return request({
    url: '/mes/vulcAlarmItems',
    method: 'put',
    data: data
  });
};

/**
 * 删除报警项目信息
 * @param alarmItemsId
 */
export const delVulcAlarmItems = (alarmItemsId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/vulcAlarmItems/' + alarmItemsId,
    method: 'delete'
  });
};


/**
 * 下拉框查询报警项目信息列表
 * @param query
 * @returns {*}
 */
export function getProdVulcAlarmItemsList (query) {
    return request({
        url: '/mes/vulcAlarmItems/getProdVulcAlarmItemsList',
        method: 'get',
        params: query
    });
};
