import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PackingSpecsVO, PackingSpecsForm, PackingSpecsQuery } from '@/api/amz/packingSpecs/types';

/**
 * 查询产品装箱规格列表
 * @param query
 * @returns {*}
 */

export const listPackingSpecs = (query?: PackingSpecsQuery): AxiosPromise<PackingSpecsVO[]> => {
  return request({
    url: '/amz/packingSpecs/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品装箱规格详细
 * @param id
 */
export const getPackingSpecs = (id: string | number): AxiosPromise<PackingSpecsVO> => {
  return request({
    url: '/amz/packingSpecs/' + id,
    method: 'get'
  });
};

/**
 * 新增产品装箱规格
 * @param data
 */
export const addPackingSpecs = (data: PackingSpecsForm) => {
  return request({
    url: '/amz/packingSpecs',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品装箱规格
 * @param data
 */
export const updatePackingSpecs = (data: PackingSpecsForm) => {
  return request({
    url: '/amz/packingSpecs',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品装箱规格
 * @param id
 */
export const delPackingSpecs = (id: string | number | Array<string | number>) => {
  return request({
    url: '/amz/packingSpecs/' + id,
    method: 'delete'
  });
};
