import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderEvaluationVO, OrderEvaluationForm, OrderEvaluationQuery } from '@/api/order/orderEvaluation/types';

/**
 * 查询订单评价列表
 * @param query
 * @returns {*}
 */

export const listOrderEvaluation = (query?: OrderEvaluationQuery): AxiosPromise<OrderEvaluationVO[]> => {
  return request({
    url: '/order/orderEvaluation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单评价详细
 * @param id
 */
export const getOrderEvaluation = (id: string | number): AxiosPromise<OrderEvaluationVO> => {
  return request({
    url: '/order/orderEvaluation/' + id,
    method: 'get'
  });
};

/**
 * 新增订单评价
 * @param data
 */
export const addOrderEvaluation = (data: OrderEvaluationForm) => {
  return request({
    url: '/order/orderEvaluation',
    method: 'post',
    data: data
  });
};

/**
 * 修改订单评价
 * @param data
 */
export const updateOrderEvaluation = (data: OrderEvaluationForm) => {
  return request({
    url: '/order/orderEvaluation',
    method: 'put',
    data: data
  });
};

/**
 * 删除订单评价
 * @param id
 */
export const delOrderEvaluation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/orderEvaluation/' + id,
    method: 'delete'
  });
};
