import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsRecordShutDownVO, DmsRecordShutDownForm, DmsRecordShutDownQuery } from '@/api/dms/dmsRecordShutDown/types';

/**
 * 查询停机记录列表
 * @param query
 * @returns {*}
 */

export const listDmsRecordShutDown = (query?: DmsRecordShutDownQuery): AxiosPromise<DmsRecordShutDownVO[]> => {
  return request({
    url: '/dms/dmsRecordShutDown/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停机记录详细
 * @param recordShutDownId
 */
export const getDmsRecordShutDown = (recordShutDownId: string | number): AxiosPromise<DmsRecordShutDownVO> => {
  return request({
    url: '/dms/dmsRecordShutDown/' + recordShutDownId,
    method: 'get'
  });
};

/**
 * 新增停机记录
 * @param data
 */
export const addDmsRecordShutDown = (data: DmsRecordShutDownForm) => {
  return request({
    url: '/dms/dmsRecordShutDown',
    method: 'post',
    data: data
  });
};

/**
 * 修改停机记录
 * @param data
 */
export const updateDmsRecordShutDown = (data: DmsRecordShutDownForm) => {
  return request({
    url: '/dms/dmsRecordShutDown',
    method: 'put',
    data: data
  });
};

/**
 * 删除停机记录
 * @param recordShutDownId
 */
export const delDmsRecordShutDown = (recordShutDownId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsRecordShutDown/' + recordShutDownId,
    method: 'delete'
  });
};


/**
 * 下拉框查询停机记录列表
 * @param query
 * @returns {*}
 */
export function getDmsRecordShutDownList (query) {
    return request({
        url: '/dms/dmsRecordShutDown/getDmsRecordShutDownList',
        method: 'get',
        params: query
    });
};
