import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RecordDnbInstantVO, RecordDnbInstantForm, RecordDnbInstantQuery } from '@/api/ems/record/types';

/**
 * 查询DNB即时数据列表
 */
export function listRecordDnbInstant(query: RecordDnbInstantQuery): AxiosPromise<RecordDnbInstantVO[]> {
  return request({
    url: '/ems/record/recordDnbInstant/list',
    method: 'get',
    params: query
  });
}

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

/**
 * 新增DNB即时数据
 */
export function addRecordDnbInstant(data: RecordDnbInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordDnbInstant',
    method: 'post',
    data: data
  });
}

/**
 * 修改DNB即时数据
 */
export function updateRecordDnbInstant(data: RecordDnbInstantForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordDnbInstant',
    method: 'put',
    data: data
  });
}

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

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

// 查询电实时数据（曲线）
export function dnbInstantList(query) {
  return request({
    url: '/ems/record/recordDnbInstant/dnbInstantList',
    method: 'get',
    params: query
  })
}
