import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseShutReasonVO, DmsBaseShutReasonForm, DmsBaseShutReasonQuery } from '@/api/dms/dmsBaseShutReason/types';

/**
 * 查询停机原因信息列表
 * @param query
 * @returns {*}
 */

export const listDmsBaseShutReason = (query?: DmsBaseShutReasonQuery): AxiosPromise<DmsBaseShutReasonVO[]> => {
  return request({
    url: '/dms/dmsBaseShutReason/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停机原因信息详细
 * @param shutReasonId
 */
export const getDmsBaseShutReason = (shutReasonId: string | number): AxiosPromise<DmsBaseShutReasonVO> => {
  return request({
    url: '/dms/dmsBaseShutReason/' + shutReasonId,
    method: 'get'
  });
};

/**
 * 新增停机原因信息
 * @param data
 */
export const addDmsBaseShutReason = (data: DmsBaseShutReasonForm) => {
  return request({
    url: '/dms/dmsBaseShutReason',
    method: 'post',
    data: data
  });
};

/**
 * 修改停机原因信息
 * @param data
 */
export const updateDmsBaseShutReason = (data: DmsBaseShutReasonForm) => {
  return request({
    url: '/dms/dmsBaseShutReason',
    method: 'put',
    data: data
  });
};

/**
 * 删除停机原因信息
 * @param shutReasonId
 */
export const delDmsBaseShutReason = (shutReasonId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseShutReason/' + shutReasonId,
    method: 'delete'
  });
};


/**
 * 下拉框查询停机原因信息列表
 * @param query
 * @returns {*}
 */
export function getDmsBaseShutReasonList (query) {
    return request({
        url: '/dms/dmsBaseShutReason/getDmsBaseShutReasonList',
        method: 'get',
        params: query
    });
};
