import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShipForwardVO, ShipForwardForm, ShipForwardQuery } from '@/api/amz/shipForward/types';

/**
 * 查询货件转发列表
 * @param query
 * @returns {*}
 */

export const listShipForward = (query?: ShipForwardQuery): AxiosPromise<ShipForwardVO[]> => {
  return request({
    url: '/amz/shipForward/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询货件转发详细
 * @param id
 */
export const getShipForward = (id: string | number): AxiosPromise<ShipForwardVO> => {
  return request({
    url: '/amz/shipForward/' + id,
    method: 'get'
  });
};

/**
 * 新增货件转发
 * @param data
 */
export const addShipForward = (data: ShipForwardForm) => {
  return request({
    url: '/amz/shipForward',
    method: 'post',
    data: data
  });
};

/**
 * 修改货件转发
 * @param data
 */
export const updateShipForward = (data: ShipForwardForm) => {
  return request({
    url: '/amz/shipForward',
    method: 'put',
    data: data
  });
};

/**
 * 修改货件转发
 * @param data
 */
export const sendUpdateShipForward = (data: ShipForwardForm) => {
  return request({
    url: '/amz/shipForward/sendUpdate',
    method: 'put',
    data: data
  });
};

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