import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConfigVO, ConfigForm, ConfigQuery } from '@/api/system/business/tournamentConfig/types';

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

export const listConfig = (query?: ConfigQuery): AxiosPromise<ConfigVO[]> => {
  return request({
    url: '/business/tournamentConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询MTT 赛事配置详细
 * @param id
 */
export const getConfig = (id: string | number): AxiosPromise<ConfigVO> => {
  return request({
    url: '/business/tournamentConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增MTT 赛事配置
 * @param data
 */
export const addConfig = (data: ConfigForm) => {
  return request({
    url: '/business/tournamentConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改MTT 赛事配置
 * @param data
 */
export const updateConfig = (data: ConfigForm) => {
  return request({
    url: '/business/tournamentConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除MTT 赛事配置
 * @param id
 */
export const delConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/tournamentConfig/' + id,
    method: 'delete'
  });
};
/**
 * 查询赛事配置下拉列表
 */
export const selectTournamentConfigSelList = (): AxiosPromise<ConfigVO> => {
  return request({
    url: '/business/tournamentConfig/selectTournamentConfigSelList',
    method: 'get'
  });
};
