import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RegionVO, RegionForm, RegionQuery } from '@/api/system/region/types';

/**
 * 查询【请填写功能名称】列表
 * @param query
 * @returns {*}
 */

export const listRegion = (query?: RegionQuery): AxiosPromise<RegionVO[]> => {
  return request({
    url: '/system/region/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询【请填写功能名称】详细
 * @param regionId
 */
export const getRegion = (regionId: string | number): AxiosPromise<RegionVO> => {
  return request({
    url: '/system/region/' + regionId,
    method: 'get'
  });
};

/**
 * 新增【请填写功能名称】
 * @param data
 */
export const addRegion = (data: RegionForm) => {
  return request({
    url: '/system/region',
    method: 'post',
    data: data
  });
};

/**
 * 修改【请填写功能名称】
 * @param data
 */
export const updateRegion = (data: RegionForm) => {
  return request({
    url: '/system/region',
    method: 'put',
    data: data
  });
};

/**
 * 删除【请填写功能名称】
 * @param regionId
 */
export const delRegion = (regionId: string | number | Array<string | number>) => {
  return request({
    url: '/system/region/' + regionId,
    method: 'delete'
  });
};
