import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsRealtimeStatusHistoryVO, DmsRealtimeStatusHistoryForm, DmsRealtimeStatusHistoryQuery } from '@/api/dms/DmsRealtimeStatusHistory/types';

/**
 * 查询设备实时状态历史记录列表
 * @param query
 * @returns {*}
 */

export const listDmsRealtimeStatusHistory = (query?: DmsRealtimeStatusHistoryQuery): AxiosPromise<DmsRealtimeStatusHistoryVO[]> => {
  return request({
    url: '/dms/DmsRealtimeStatusHistory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备实时状态历史记录详细
 * @param historyId
 */
export const getDmsRealtimeStatusHistory = (historyId: string | number): AxiosPromise<DmsRealtimeStatusHistoryVO> => {
  return request({
    url: '/dms/DmsRealtimeStatusHistory/' + historyId,
    method: 'get'
  });
};

/**
 * 新增设备实时状态历史记录
 * @param data
 */
export const addDmsRealtimeStatusHistory = (data: DmsRealtimeStatusHistoryForm) => {
  return request({
    url: '/dms/DmsRealtimeStatusHistory',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备实时状态历史记录
 * @param data
 */
export const updateDmsRealtimeStatusHistory = (data: DmsRealtimeStatusHistoryForm) => {
  return request({
    url: '/dms/DmsRealtimeStatusHistory',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备实时状态历史记录
 * @param historyId
 */
export const delDmsRealtimeStatusHistory = (historyId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/DmsRealtimeStatusHistory/' + historyId,
    method: 'delete'
  });
};


/**
 * 下拉框查询设备实时状态历史记录列表
 * @param query
 * @returns {*}
 */
export function getDmsRealtimeStatusHistoryList (query) {
    return request({
        url: '/dms/DmsRealtimeStatusHistory/getDmsRealtimeStatusHistoryList',
        method: 'get',
        params: query
    });
};
