import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ComplaintsSuggestionsVO, ComplaintsSuggestionsForm, ComplaintsSuggestionsQuery } from '@/api/customer/complaintsSuggestions/types';

/**
 * 查询投诉与建议记录列表
 * @param query
 * @returns {*}
 */

export const listComplaintsSuggestions = (query?: ComplaintsSuggestionsQuery): AxiosPromise<ComplaintsSuggestionsVO[]> => {
  return request({
    url: '/customer/complaintsSuggestions/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询投诉与建议记录详细
 * @param id
 */
export const getComplaintsSuggestions = (id: string | number): AxiosPromise<ComplaintsSuggestionsVO> => {
  return request({
    url: '/customer/complaintsSuggestions/' + id,
    method: 'get'
  });
};

/**
 * 新增投诉与建议记录
 * @param data
 */
export const addComplaintsSuggestions = (data: ComplaintsSuggestionsForm) => {
  return request({
    url: '/customer/complaintsSuggestions',
    method: 'post',
    data: data
  });
};

/**
 * 修改投诉与建议记录
 * @param data
 */
export const updateComplaintsSuggestions = (data: ComplaintsSuggestionsForm) => {
  return request({
    url: '/customer/complaintsSuggestions',
    method: 'put',
    data: data
  });
};

/**
 * 删除投诉与建议记录
 * @param id
 */
export const delComplaintsSuggestions = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/complaintsSuggestions/' + id,
    method: 'delete'
  });
};
