import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace EnergyStationConfigApi {
  export interface Config {
    id?: number;
    stationId?: number;
    stationName?: string;
    autoDeduct?: boolean;
    autoMatch?: boolean;
    cooperationType?: number;
    remark?: string;
    createTime?: string;
  }

  export interface ConfigSimple {
    id: number;
    stationId: number;
    stationName: string;
  }
}

export function getStationConfigPage(params: PageParam) {
  return requestClient.get<PageResult<EnergyStationConfigApi.Config>>(
    '/energy/station-config/page',
    { params },
  );
}

export function getStationConfigSimpleList() {
  return requestClient.get<EnergyStationConfigApi.ConfigSimple[]>(
    '/energy/station-config/simple-list',
  );
}

export function createStationConfig(data: EnergyStationConfigApi.Config) {
  return requestClient.post('/energy/station-config/create', data);
}

export function updateStationConfig(data: EnergyStationConfigApi.Config) {
  return requestClient.put('/energy/station-config/update', data);
}
