import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LogisticsOrderVO, LogisticsOrderForm, LogisticsOrderQuery, createOrderForm, InquiryQuoteStatusVO } from '@/api/amz/logisticsOrder/types';

/**
 * 查询物流订单列表
 * @param query
 * @returns {*}
 */

export const listLogisticsOrder = (query?: LogisticsOrderQuery): AxiosPromise<LogisticsOrderVO[]> => {
  return request({
    url: '/amz/logisticsOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物流订单详细
 * @param id
 */
export const getLogisticsOrder = (id: string | number): AxiosPromise<InquiryQuoteStatusVO> => {
  return request({
    url: '/amz/logisticsOrder/' + id,
    method: 'get'
  });
};

// /**
//  * 查询物流订单详细
//  * @param id
//  */
// export const getTodayQuoteStatus = (): AxiosPromise<InquiryQuoteStatusVO[]> => {
//   return request({
//     url: '/amz/logisticsOrder/today-quote-status',
//     method: 'get'
//   });
// };

export const addLogisticsOrder = (data: LogisticsOrderForm) => {
  return request({
    url: '/amz/logisticsOrder',
    method: 'post',
    data: data
  });
};

/**
 * 查询快到期的物流订单
 * @param data
 */
export const queryLogisticsOrder = () => {
  return request({
    url: '/amz/logisticsOrder/query',
    method: 'get'
  });
};

/**
 * 创建物流订单
 * @param data
 */
export const createLogisticsOrder = (data: createOrderForm) => {
  return request({
    url: '/amz/logisticsOrder/createOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改物流订单
 * @param data
 */
export const updateLogisticsOrder = (data: LogisticsOrderForm) => {
  return request({
    url: '/amz/logisticsOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除物流订单
 * @param id
 */
export const delLogisticsOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/amz/logisticsOrder/' + id,
    method: 'delete'
  });
};


