import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShipmentItemVO, ShipmentItemForm, ShipmentItemQuery } from '@/api/amz/shipmentItem/types';

/**
 * 查询货品明细列表
 * @param query
 * @returns {*}
 */

export const listShipmentItem = (query?: ShipmentItemQuery): AxiosPromise<ShipmentItemVO[]> => {
  return request({
    url: '/amz/shipmentItem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询货品明细详细
 * @param id
 */
export const getShipmentItem = (id: string | number): AxiosPromise<ShipmentItemVO> => {
  return request({
    url: '/amz/shipmentItem/' + id,
    method: 'get'
  });
};

/**
 * 新增货品明细
 * @param data
 */
export const addShipmentItem = (data: ShipmentItemForm) => {
  return request({
    url: '/amz/shipmentItem',
    method: 'post',
    data: data
  });
};

/**
 * 修改货品明细
 * @param data
 */
export const updateShipmentItem = (data: ShipmentItemForm) => {
  return request({
    url: '/amz/shipmentItem',
    method: 'put',
    data: data
  });
};

/**
 * 删除货品明细
 * @param id
 */
export const delShipmentItem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/amz/shipmentItem/' + id,
    method: 'delete'
  });
};
