import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PurchaseOutOrderVO, PurchaseOutOrderForm, PurchaseOutOrderQuery } from '@/api/amz/purchaseOutOrder/types';

/**
 * 查询组合订单列表
 * @param query
 * @returns {*}
 */

export const listPurchaseOutOrder = (query?: PurchaseOutOrderQuery): AxiosPromise<PurchaseOutOrderVO[]> => {
  return request({
    url: '/amz/purchaseOutOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询组合订单详细
 * @param tenantId
 */
export const getPurchaseOutOrder = (tenantId: string | number): AxiosPromise<PurchaseOutOrderVO> => {
  return request({
    url: '/amz/purchaseOutOrder/' + tenantId,
    method: 'get'
  });
};

/**
 * 新增组合订单
 * @param data
 */
export const addPurchaseOutOrder = (data: PurchaseOutOrderForm) => {
  return request({
    url: '/amz/purchaseOutOrder',
    method: 'post',
    data: data
  });
};


/**
 * 新增组合订单
 * @param data
 */
export const createSendOrderByBo = (data: PurchaseOutOrderForm) => {
  return request({
    url: '/amz/purchaseOutOrder/submit',
    method: 'post',
    data: data
  });
};

/**
 * 修改组合订单
 * @param data
 */
export const updatePurchaseOutOrder = (data: PurchaseOutOrderForm) => {
  return request({
    url: '/amz/purchaseOutOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除组合订单
 * @param tenantId
 */
export const delPurchaseOutOrder = (tenantId: string | number | Array<string | number>) => {
  return request({
    url: '/amz/purchaseOutOrder/' + tenantId,
    method: 'delete'
  });
};
