import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AdviceVO, AdviceForm, AdviceQuery } from '@/api/system/advice/types';

/**
 * 查询用户反馈建议列表
 * @param query
 * @returns {*}
 */

export const listAdvice = (query?: AdviceQuery): AxiosPromise<AdviceVO[]> => {
  return request({
    url: '/system/advice/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户反馈建议详细
 * @param id
 */
export const getAdvice = (id: string | number): AxiosPromise<AdviceVO> => {
  return request({
    url: '/system/advice/' + id,
    method: 'get'
  });
};

/**
 * 新增用户反馈建议
 * @param data
 */
export const addAdvice = (data: AdviceForm) => {
  return request({
    url: '/system/advice',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户反馈建议
 * @param data
 */
export const updateAdvice = (data: AdviceForm) => {
  return request({
    url: '/system/advice',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户反馈建议
 * @param id
 */
export const delAdvice = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/advice/' + id,
    method: 'delete'
  });
};
