import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShipmentPlanVO, ShipmentPlanForm, ShipmentPlanQuery } from '@/api/amz/shipmentPlan/types';

/**
 * 查询货件计划列表
 * @param query
 * @returns {*}
 */

export const listShipmentPlan = (query?: ShipmentPlanQuery): AxiosPromise<ShipmentPlanVO[]> => {
  return request({
    url: '/amz/shipmentPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询货件计划详细
 * @param id
 */
export const getShipmentPlan = (id: string | number): AxiosPromise<ShipmentPlanVO> => {
  return request({
    url: '/amz/shipmentPlan/' + id,
    method: 'get'
  });
};


/**
 * 查询货件计划详细
 * @param id
 */
export const getQuote = (id: string | number): AxiosPromise<ShipmentPlanVO> => {
  return request({
    url: '/amz/shipmentPlan/quote' + id,
    method: 'get'
  });
};

/**
 * 新增货件计划
 * @param data
 */
export const addShipmentPlan = (data: ShipmentPlanForm) => {
  return request({
    url: '/amz/shipmentPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改货件计划
 * @param data
 */
export const updateShipmentPlan = (data: ShipmentPlanForm) => {
  return request({
    url: '/amz/shipmentPlan',
    method: 'put',
    data: data
  });
};

/**
 * 删除货件计划
 * @param id
 */
export const delShipmentPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/amz/shipmentPlan/' + id,
    method: 'delete'
  });
};
