import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShipmentTrackingVO, ShipmentTrackingForm, ShipmentTrackingQuery } from '@/api/amz/shipmentTracking/types';

/**
 * 查询物流追踪列表
 * @param query
 * @returns {*}
 */

export const listShipmentTracking = (query?: ShipmentTrackingQuery): AxiosPromise<ShipmentTrackingVO[]> => {
  return request({
    url: '/amz/shipmentTracking/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物流追踪详细
 * @param id
 */
export const getShipmentTracking = (id: string | number): AxiosPromise<ShipmentTrackingVO> => {
  return request({
    url: '/amz/shipmentTracking/' + id,
    method: 'get'
  });
};

/**
 * 新增物流追踪
 * @param data
 */
export const addShipmentTracking = (data: ShipmentTrackingForm) => {
  return request({
    url: '/amz/shipmentTracking',
    method: 'post',
    data: data
  });
};

/**
 * 修改物流追踪
 * @param data
 */
export const updateShipmentTracking = (data: ShipmentTrackingForm) => {
  return request({
    url: '/amz/shipmentTracking',
    method: 'put',
    data: data
  });
};

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