import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LogisticsOrderDetailVO, LogisticsOrderDetailForm, LogisticsOrderDetailQuery } from '@/api/amz/logisticsOrderDetail/types';

/**
 * 查询物流订单明细（按箱子维度存储）列表
 * @param query
 * @returns {*}
 */

export const listLogisticsOrderDetail = (query?: LogisticsOrderDetailQuery): AxiosPromise<LogisticsOrderDetailVO[]> => {
  return request({
    url: '/amz/logisticsOrderDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物流订单明细（按箱子维度存储）详细
 * @param id
 */
export const getLogisticsOrderDetail = (id: string | number): AxiosPromise<LogisticsOrderDetailVO> => {
  return request({
    url: '/amz/logisticsOrderDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增物流订单明细（按箱子维度存储）
 * @param data
 */
export const addLogisticsOrderDetail = (data: LogisticsOrderDetailForm) => {
  return request({
    url: '/amz/logisticsOrderDetail',
    method: 'post',
    data: data
  });
};

/**
 * 新增物流订单明细（按箱子维度存储）
 * @param data
 */
export const updateList = (data: LogisticsOrderDetailForm[]) => {
  return request({
    url: '/amz/logisticsOrderDetail/updateList',
    method: 'post',
    data: data
  });
};

/**
 * 修改物流订单明细（按箱子维度存储）
 * @param data
 */
export const updateLogisticsOrderDetail = (data: LogisticsOrderDetailForm) => {
  return request({
    url: '/amz/logisticsOrderDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除物流订单明细（按箱子维度存储）
 * @param id
 */
export const delLogisticsOrderDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/amz/logisticsOrderDetail/' + id,
    method: 'delete'
  });
};
