import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CompetitionZoneVO, CompetitionZoneForm, CompetitionZoneQuery } from '@/api/system/physical/competitionZone/types';

/**
 * 查询赛区配置列表
 * @param query
 * @returns {*}
 */

export const listCompetitionZone = (query?: CompetitionZoneQuery): AxiosPromise<CompetitionZoneVO[]> => {
  return request({
    url: '/physical/competitionZone/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询赛区配置详细
 * @param id
 */
export const getCompetitionZone = (id: string | number): AxiosPromise<CompetitionZoneVO> => {
  return request({
    url: '/physical/competitionZone/' + id,
    method: 'get'
  });
};

/**
 * 新增赛区配置
 * @param data
 */
export const addCompetitionZone = (data: CompetitionZoneForm) => {
  return request({
    url: '/physical/competitionZone',
    method: 'post',
    data: data
  });
};

/**
 * 修改赛区配置
 * @param data
 */
export const updateCompetitionZone = (data: CompetitionZoneForm) => {
  return request({
    url: '/physical/competitionZone',
    method: 'put',
    data: data
  });
};

/**
 * 删除赛区配置
 * @param id
 */
export const delCompetitionZone = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/competitionZone/' + id,
    method: 'delete'
  });
};
export const selectCompetitionZoneSelList = (): AxiosPromise<CompetitionZoneVO[]> => {
  return request({
    url: '/physical/competitionZone/selectCompetitionZoneSelList',
    method: 'get'
  });
};
