import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RecordWaterInstantVO, RecordWaterInstantForm, RecordWaterInstantQuery } from '@/api/ems/record/types';

/**
 * 查询水即时数据列表
 */
export function listRecordWaterInstant(query: RecordWaterInstantQuery): AxiosPromise<RecordWaterInstantVO[]> {
  return request({
    url: '/ems/record/recordWaterInstant/list',
    method: 'get',
    params: query
  });
}

/**
 * 查询水即时数据详细
 */
export function getRecordWaterInstant(objId: string | number): AxiosPromise<RecordWaterInstantVO> {
  return request({
    url: '/ems/record/recordWaterInstant/' + objId,
    method: 'get'
  });
}

/**
 * 新增水即时数据
 */
export function addRecordWaterInstant(data: RecordWaterInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordWaterInstant',
    method: 'post',
    data: data
  });
}

/**
 * 修改水即时数据
 */
export function updateRecordWaterInstant(data: RecordWaterInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordWaterInstant',
    method: 'put',
    data: data
  });
}

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

/**
 * 查询最新水数据
 */
export function getLatestWaterData(monitorId: string | number): AxiosPromise<RecordWaterInstantVO> {
  return request({
    url: '/ems/record/recordWaterInstant/latest/' + monitorId,
    method: 'get'
  });
}
