import type { StationInfoModel } from './model';

import type { BaseResult } from '#/api/base-result';

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

// API路径常量枚举
enum Api {
  // 导出
  export = '/sysStation/station/export',
  // 列表查询
  list = '/sysStation/station/list',
  // 基础路径
  root = '/sysStation/station',
  selectAllSysStation = '/sysStation/station/selectAllSysStationList',
  // 查询所有片区信息  /sysStationArea/area/selectAllSysStationAreaList
  selectAllSysStationAreaList = '/sysStationArea/area/selectAllSysStationAreaList',
}

export function selectAllSysAreaList() {
  return requestClient.get<BaseResult<StationInfoModel[]>>(
    Api.selectAllSysStationAreaList,
  );
}
/**
 * 查询所有油站信息
 * @returns 油站列表
 */
export function selectAllSysStationAreaList(params: any) {
  return requestClient.get<BaseResult<StationInfoModel[]>>(
    Api.selectAllSysStationAreaList,
    {
      params,
    },
  );
}

/**
 * 查询所有油站信息
 * @returns 油站列表
 */
export function selectAllSysStation(params: any) {
  return requestClient.get<BaseResult<StationInfoModel[]>>(
    Api.selectAllSysStation,
    {
      params,
    },
  );
}
/**
 * 查询油站信息列表
 * @param params 查询参数
 * @returns 分页结果
 */
export function stationInfoList(params: any) {
  return requestClient.get<BaseResult<StationInfoModel[]>>(Api.list, {
    params,
  });
}

/**
 * 获取油站详细信息
 * @param id 油站ID
 * @returns 油站详情
 */
export function getStationInfoDetail(id: number) {
  return requestClient.get<StationInfoModel>(`${Api.root}/${id}`);
}

/**
 * 新增油站
 * @param data 油站数据
 * @returns 操作结果
 */
export function addStationInfo(data: StationInfoModel) {
  return requestClient.post(Api.root, data, {
    successMessageMode: 'message',
  });
}

/**
 * 修改油站
 * @param data 油站数据
 * @returns 操作结果
 */
export function updateStationInfo(data: StationInfoModel) {
  return requestClient.put(Api.root, data, {
    successMessageMode: 'message',
  });
}

/**
 * 删除油站信息
 * @param ids 油站ID数组
 * @returns 操作结果
 */
export function deleteStationInfo(ids: number[]) {
  return requestClient.delete(`${Api.root}/${ids.join(',')}`, {
    successMessageMode: 'message',
  });
}

/**
 * 导出油站信息列表
 * @param data 导出参数
 * @returns 导出结果
 */
export function exportStationInfo(data: Partial<StationInfoModel>) {
  return commonExport(Api.export, data);
}
