import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ElectricityPriceForm, ElectricityPriceQuery, ElectricityPriceVO } from './types';

export const listElectricityPrices = (params?: ElectricityPriceQuery): AxiosPromise<ElectricityPriceVO[]> => {
  return request({
    url: '/electricityManagement/electricityPrices/list',
    method: 'get',
    params
  });
};

export const getElectricityPrice = (id: string | number): AxiosPromise<ElectricityPriceVO> => {
  return request({
    url: '/electricityManagement/electricityPrices/' + id,
    method: 'get'
  });
};

export const addElectricityPrice = (data: ElectricityPriceForm) => {
  return request({
    url: '/electricityManagement/electricityPrices',
    method: 'post',
    data
  });
};

export const updateElectricityPrice = (data: ElectricityPriceForm) => {
  return request({
    url: '/electricityManagement/electricityPrices',
    method: 'put',
    data
  });
};

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