import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EnergyMetricForm, EnergyMetricQuery, EnergyMetricVO } from './types';

export const listEnergyMetric = (params?: EnergyMetricQuery): AxiosPromise<EnergyMetricVO[]> => {
  return request({
    url: '/ems/energyMetric/list',
    method: 'get',
    params
  });
};

export const getEnergyMetric = (id: string | number): AxiosPromise<EnergyMetricVO> => {
  return request({
    url: '/ems/energyMetric/' + id,
    method: 'get'
  });
};

export const addEnergyMetric = (data: EnergyMetricForm) => {
  return request({
    url: '/ems/energyMetric',
    method: 'post',
    data
  });
};

export const updateEnergyMetric = (data: EnergyMetricForm) => {
  return request({
    url: '/ems/energyMetric',
    method: 'put',
    data
  });
};

export const delEnergyMetric = (ids: string | number | Array<string | number>) => {
  return request({
    url: '/ems/energyMetric/' + ids,
    method: 'delete'
  });
};
