import apis from '../utils/request';
const { GET, POST, PUT, DELETE } = apis

// 常见问题
export const getQuestions = async function() {
  return await GET(`/wx/getQuestions`);
}

// 提交意见反馈
export const createOption = async function(data) {
  return await POST(`/wx/option`, data);
}

// 获取自己提交的意见列表
export const getOptionList = async function() {
  return await GET(`/wx/getOptionList`);
}

// 查询意见详情
export const getOptionDetail = async function(id) {
  return await GET(`/wx/getOptionDetail/${id}`);
}

// 提交意见反馈
export const deleteOption = async function() {
  return await DELETE(`/wx/deleteOption/${id}`);
}

// 提交意见反馈
export const aboutUs = async function() {
  return await GET(`/wx/aboutUs`);
}

// 获取特色服务列表
export const getServicesList = async function() {
  return await GET(`/wx/getServicesList?status=2`);
}

// 获取分类列表
export const getCategoryList = async function() {
  return await GET(`/wx/getCategoryList?status=2`);
}

// 获取分类列表
export const getEncyclopediaList = async function(categoryId, page) {
  return await GET(`/wx/getEncyclopedia?status=2&page=${page}&categoryId=${categoryId}`);
}

// 获取分类列表
export const getEncyclopediaDetail = async function(id) {
  return await GET(`/wx/getEncyclopediaDetail/${id}`);
}

// 获取banner列表
export const getBannerList = async function(park = "", address = "") {
  return await GET(`/wx/getBannerList?park=${park}&address=${address}`);
}

// 获取财务/律师援助列表
export const getAidList = async function(page = 1, size = 10, type = 0) {
  return await GET(`/aid/getList?page=${page}&size=${size}&type=${type}`);
}

// 获取财务/律师援助详情
export const getAidDetail = async function(id) {
  return await GET(`/aid/detail/${id}`);
}

// 提交财务/律师援助
export const askAid = async function(data) {
  return await POST(`/wx/aid/approve`, data);
}

// 获取当前积分
export const getCurrentIntegral = async function() {
  return await GET(`/integral/getWxIntegralList`);
}

// 获取积分明细
export const getIntegralRecord = async function({ page, size }) {
  return await GET(`/integral/getWxIntegralList/detail?page=${page}&size=${size}`);
}

// 获取优惠券列表
export const getRedeemableCoupons = async function({ page = '', size = '', type }) {
  return await GET(`/wx/getRedeemableCoupons?page=${page}&size=${size}&type=${type}`);
}

// 兑换/领取优惠券
export const redeemCoupons = async function({ id, type }) {
  return await POST(`/wx/redeemCoupons`, { id, type });
}

// 获取当前拥有的优惠券列表
export const getCurrentCoupons = async function() {
  return await GET(`/wx/getCurrentCoupons`);
}

