import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ComplaintVO, ComplaintQuery, ComplaintDealForm } from '@/api/system/complaint/types';

/**
 * 查询投诉建议列表
 * @Author: Antigravity
 */
export const listComplaint = (query?: ComplaintQuery): AxiosPromise<ComplaintVO[]> => {
  return request({
    url: '/system/complaint/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询投诉建议详情
 * @Author: Antigravity
 */
export const getComplaintDetail = (id: string | number): AxiosPromise<ComplaintVO> => {
  return request({
    url: '/system/complaint/detail/' + id,
    method: 'get'
  });
};

/**
 * 处理投诉建议
 * @Author: Antigravity
 */
export const dealComplaint = (data: ComplaintDealForm) => {
  return request({
    url: '/system/complaint/deal',
    method: 'put',
    data: data
  });
};

/**
 * 删除投诉建议
 * @Author: Antigravity
 */
export const delComplaint = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/complaint/' + id,
    method: 'delete'
  });
};
