import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LogisticsQuoteVO, LogisticsQuoteForm, LogisticsQuoteQuery } from '@/api/amz/logisticsQuote/types';

/**
 * 查询物流报价列表
 * @param query
 * @returns {*}
 */

export const listLogisticsQuote = (query?: LogisticsQuoteQuery): AxiosPromise<LogisticsQuoteVO[]> => {
  return request({
    url: '/amz/logisticsQuote/list',
    method: 'get',
    params: query
  });
};

/**
 * 根据目的地仓库和渠道查询物流报价列表
 * @returns {*}
 * @param destination
 * @param channelId
 */

export const queryLogisticsQuote = (destination: string, channelId: string): AxiosPromise<LogisticsQuoteVO[]> => {
  return request({
    url: '/amz/logisticsQuote/query/' + destination + '/' + channelId,
    method: 'get'
  });
};

/**
 * 查询物流报价详细
 * @param id
 */
export const getLogisticsQuote = (id: string | number): AxiosPromise<LogisticsQuoteVO> => {
  return request({
    url: '/amz/logisticsQuote/' + id,
    method: 'get'
  });
};

/**
 * 新增物流报价
 * @param data
 */
export const addLogisticsQuote = (data: LogisticsQuoteForm) => {
  return request({
    url: '/amz/logisticsQuote',
    method: 'post',
    data: data
  });
};

/**
 * 修改物流报价
 * @param data
 */
export const updateLogisticsQuote = (data: LogisticsQuoteForm) => {
  return request({
    url: '/amz/logisticsQuote',
    method: 'put',
    data: data
  });
};

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