import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParticipantsVO, ParticipantsForm, ParticipantsQuery } from '@/api/system/physical/participants/types';

/**
 * 查询线下用户报名列表
 * @param query
 * @returns {*}
 */

export const listParticipants = (query?: ParticipantsQuery): AxiosPromise<ParticipantsVO[]> => {
  return request({
    url: '/physical/participants/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询线下用户报名详细
 * @param id
 */
export const getParticipants = (id: string | number): AxiosPromise<ParticipantsVO> => {
  return request({
    url: '/physical/participants/' + id,
    method: 'get'
  });
};

/**
 * 新增线下用户报名
 * @param data
 */
export const addParticipants = (data: ParticipantsForm) => {
  return request({
    url: '/physical/participants',
    method: 'post',
    data: data
  });
};

/**
 * 修改线下用户报名
 * @param data
 */
export const updateParticipants = (data: ParticipantsForm) => {
  return request({
    url: '/physical/participants',
    method: 'put',
    data: data
  });
};

/**
 * 删除线下用户报名
 * @param id
 */
export const delParticipants = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/participants/' + id,
    method: 'delete'
  });
};
/**
 * 晋级
 * @param data
 */
export const promoteTournament = (data: ParticipantsForm) => {
  return request({
    url: '/physical/participants/promoteTournament',
    method: 'post',
    data: data
  });
};
