import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RecordSteamInstantVO, RecordSteamInstantForm, RecordSteamInstantQuery } from '@/api/ems/record/types';

/**
 * 查询蒸汽即时数据列表
 */
export function listRecordSteamInstant(query: RecordSteamInstantQuery): AxiosPromise<RecordSteamInstantVO[]> {
  return request({
    url: '/ems/record/recordSteamInstant/list',
    method: 'get',
    params: query
  });
}

/**
 * 查询蒸汽即时数据详细
 */
export function getRecordSteamInstant(objId: string | number): AxiosPromise<RecordSteamInstantVO> {
  return request({
    url: '/ems/record/recordSteamInstant/' + objId,
    method: 'get'
  });
}

/**
 * 新增蒸汽即时数据
 */
export function addRecordSteamInstant(data: RecordSteamInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordSteamInstant',
    method: 'post',
    data: data
  });
}

/**
 * 修改蒸汽即时数据
 */
export function updateRecordSteamInstant(data: RecordSteamInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordSteamInstant',
    method: 'put',
    data: data
  });
}

/**
 * 删除蒸汽即时数据
 */
export function delRecordSteamInstant(objId: string | number | Array<string | number>): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordSteamInstant/' + objId,
    method: 'delete'
  });
}

/**
 * 查询最新蒸汽数据
 */
export function getLatestSteamData(monitorId: string | number): AxiosPromise<RecordSteamInstantVO> {
  return request({
    url: '/ems/record/recordSteamInstant/latest/' + monitorId,
    method: 'get'
  });
}

//查询蒸汽时间段内的消耗量
export function getExpendSum(query) {
  return request({
    url: '/ems/record/recordSteamInstant/getExpendSum',
    method: 'get',
    params: query
  })
}

// 查询蒸汽历史数据（曲线）
export function steamInstantList(query) {
  return request({
    url: '/ems/record/recordSteamInstant/steamInstantList',
    method: 'get',
    params: query
  })
}

//查询蒸汽实时最后一条数据
export function latestSteamInstantList(query) {
  return request({
    url: '/ems/record/recordSteamInstant/latestSteamInstantList',
    method: 'get',
    params: query
  })
}
