import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PolicyVO, PolicyForm, PolicyQuery } from '@/api/system/business/policy/types';

/**
 * 查询隐私声明列表
 * @param query
 * @returns {*}
 */

export const listPolicy = (query?: PolicyQuery): AxiosPromise<PolicyVO[]> => {
  return request({
    url: '/business/policy/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询隐私声明详细
 * @param id
 */
export const getPolicy = (id: string | number): AxiosPromise<PolicyVO> => {
  return request({
    url: '/business/policy/' + id,
    method: 'get'
  });
};

/**
 * 新增隐私声明
 * @param data
 */
export const addPolicy = (data: PolicyForm) => {
  return request({
    url: '/business/policy',
    method: 'post',
    data: data
  });
};

/**
 * 修改隐私声明
 * @param data
 */
export const updatePolicy = (data: PolicyForm) => {
  return request({
    url: '/business/policy',
    method: 'put',
    data: data
  });
};

/**
 * 删除隐私声明
 * @param id
 */
export const delPolicy = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/policy/' + id,
    method: 'delete'
  });
};

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