import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GameEventConfigVO, GameEventConfigForm, GameEventConfigQuery } from '@/api/system/gameEventConfig/types';

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

export const listGameEventConfig = (query?: GameEventConfigQuery): AxiosPromise<GameEventConfigVO[]> => {
  return request({
    url: '/system/gameEventConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询赛事配置详细
 * @param configId
 */
export const getGameEventConfig = (configId: string | number): AxiosPromise<GameEventConfigVO> => {
  return request({
    url: '/system/gameEventConfig/' + configId,
    method: 'get'
  });
};

/**
 * 新增赛事配置
 * @param data
 */
export const addGameEventConfig = (data: GameEventConfigForm) => {
  return request({
    url: '/system/gameEventConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改赛事配置
 * @param data
 */
export const updateGameEventConfig = (data: GameEventConfigForm) => {
  return request({
    url: '/system/gameEventConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除赛事配置
 * @param configId
 */
export const delGameEventConfig = (configId: string | number | Array<string | number>) => {
  return request({
    url: '/system/gameEventConfig/' + configId,
    method: 'delete'
  });
};
