import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TermsVO, TermsForm, TermsQuery } from '@/api/system/business/terms/types';

/**
 * 查询运动申明列表
 * @param query
 * @returns {*}
 */

export const listTerms = (query?: TermsQuery): AxiosPromise<TermsVO[]> => {
  return request({
    url: '/business/terms/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询运动申明详细
 * @param id
 */
export const getTerms = (id: string | number): AxiosPromise<TermsVO> => {
  return request({
    url: '/business/terms/' + id,
    method: 'get'
  });
};

/**
 * 新增运动申明
 * @param data
 */
export const addTerms = (data: TermsForm) => {
  return request({
    url: '/business/terms',
    method: 'post',
    data: data
  });
};

/**
 * 修改运动申明
 * @param data
 */
export const updateTerms = (data: TermsForm) => {
  return request({
    url: '/business/terms',
    method: 'put',
    data: data
  });
};

/**
 * 删除运动申明
 * @param id
 */
export const delTerms = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/terms/' + id,
    method: 'delete'
  });
};

/**
 * 查询默认数据展示H5页面 接口
 * @param id
 */
export const getSportTermsListMax = (): AxiosPromise<TermsVO> => {
  return request({
    url: '/business/terms/getSportTermsListMax',
    method: 'get'
  });
};
/**
 * 查询默认数据展示H5页面 接口
 * @param id
 */
export const getServiceAgreementMax = (): AxiosPromise<TermsVO> => {
  return request({
    url: '/business/terms/getServiceAgreementMax',
    method: 'get'
  });
};
