import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  TournamentsRegistrationVO,
  TournamentsRegistrationForm,
  TournamentsRegistrationQuery
} from '@/api/system/physical/tournamentsRegistration/types';

/**
 * 查询预报名列表
 * @param query
 * @returns {*}
 */

export const listTournamentsRegistration = (query?: TournamentsRegistrationQuery): AxiosPromise<TournamentsRegistrationVO[]> => {
  return request({
    url: '/physical/tournamentsRegistration/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询预报名详细
 * @param id
 */
export const getTournamentsRegistration = (id: string | number): AxiosPromise<TournamentsRegistrationVO> => {
  return request({
    url: '/physical/tournamentsRegistration/' + id,
    method: 'get'
  });
};

/**
 * 新增预报名
 * @param data
 */
export const addTournamentsRegistration = (data: TournamentsRegistrationForm) => {
  return request({
    url: '/physical/tournamentsRegistration',
    method: 'post',
    data: data
  });
};

/**
 * 修改预报名
 * @param data
 */
export const updateTournamentsRegistration = (data: TournamentsRegistrationForm) => {
  return request({
    url: '/physical/tournamentsRegistration',
    method: 'put',
    data: data
  });
};
/**
 * 审核预报名
 * @param data
 */
export const auditTournamentsRegistration = (data: TournamentsRegistrationForm) => {
  return request({
    url: '/physical/tournamentsRegistration/auditTournamentsRegistration',
    method: 'put',
    data: data
  });
};
/**
 * 删除预报名
 * @param id
 */
export const delTournamentsRegistration = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/tournamentsRegistration/' + id,
    method: 'delete'
  });
};
