import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TournamentsVO, TournamentsForm, TournamentsQuery } from '@/api/demo/tournaments/types';

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

export const listTournaments = (query?: TournamentsQuery): AxiosPromise<TournamentsVO[]> => {
  return request({
    url: '/demo/tournaments/list',
    method: 'get',
    params: query
  });
};

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

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

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

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