import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AreaStationVO, AreaStationForm, AreaStationQuery, SysAreaStationTypeVo, SysAreaStationOnStoreVo } from '@/api/system/areaStation/types';

/**
 * 查询区域站点列表
 * @param query
 * @returns {*}
 */

export const listAreaStation = (query?: AreaStationQuery): AxiosPromise<AreaStationVO[]> => {
  return request({
    url: '/system/areaStation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询区域站点详细
 * @param id
 */
export const getAreaStation = (id: string | number): AxiosPromise<AreaStationVO> => {
  return request({
    url: '/system/areaStation/' + id,
    method: 'get'
  });
};

/**
 * 新增区域站点
 * @param data
 */
export const addAreaStation = (data: AreaStationForm) => {
  return request({
    url: '/system/areaStation',
    method: 'post',
    data: data
  });
};

/**
 * 修改区域站点
 * @param data
 */
export const updateAreaStation = (data: AreaStationForm) => {
  return request({
    url: '/system/areaStation',
    method: 'put',
    data: data
  });
};

/**
 * 删除区域站点
 * @param id
 */
export const delAreaStation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/areaStation/' + id,
    method: 'delete'
  });
};

/**
 * 获取区域类型
 * @Author Huanyi
 */
export const listType = (): AxiosPromise<SysAreaStationTypeVo[]> => {
  return request({
    url: '/system/areaStation/listType',
    method: 'GET'
  });
};

/**
 * 获取区域列表
 * @Author Huanyi
 */
export const listOnStore = (): AxiosPromise<SysAreaStationOnStoreVo[]> => {
  return request({
    url: '/system/areaStation/listOnStore',
    method: 'GET'
  });
};
