import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OfServiceVO, OfServiceForm, OfServiceQuery } from '@/api/system/business/ofService/types';

/**
 * 查询使用条款管理列表
 * @param query
 * @returns {*}
 */

export const listOfService = (query?: OfServiceQuery): AxiosPromise<OfServiceVO[]> => {
  return request({
    url: '/business/ofService/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询使用条款管理详细
 * @param id
 */
export const getOfService = (id: string | number): AxiosPromise<OfServiceVO> => {
  return request({
    url: '/business/ofService/' + id,
    method: 'get'
  });
};

/**
 * 新增使用条款管理
 * @param data
 */
export const addOfService = (data: OfServiceForm) => {
  return request({
    url: '/business/ofService',
    method: 'post',
    data: data
  });
};

/**
 * 修改使用条款管理
 * @param data
 */
export const updateOfService = (data: OfServiceForm) => {
  return request({
    url: '/business/ofService',
    method: 'put',
    data: data
  });
};

/**
 * 删除使用条款管理
 * @param id
 */
export const delOfService = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/ofService/' + id,
    method: 'delete'
  });
};

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