import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LogisticsChannelVO, LogisticsChannelForm, LogisticsChannelQuery } from '@/api/amz/logisticsChannel/types';

/**
 * 查询物流商渠道列表
 * @param query
 * @returns {*}
 */

export const listLogisticsChannel = (query?: LogisticsChannelQuery): AxiosPromise<LogisticsChannelVO[]> => {
  return request({
    url: '/amz/logisticsChannel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询所有物流商渠道列表
 * @param query
 * @returns {*}
 */

export const listAllLogisticsChannel = (): AxiosPromise<LogisticsChannelVO[]> => {
  return request({
    url: '/amz/logisticsChannel/list/all',
    method: 'get'
  });
};

/**
 * 查询物流商渠道详细
 * @param id
 */
export const getLogisticsChannel = (id: string | number): AxiosPromise<LogisticsChannelVO> => {
  return request({
    url: '/amz/logisticsChannel/' + id,
    method: 'get'
  });
};

/**
 * 新增物流商渠道
 * @param data
 */
export const addLogisticsChannel = (data: LogisticsChannelForm) => {
  return request({
    url: '/amz/logisticsChannel',
    method: 'post',
    data: data
  });
};

/**
 * 修改物流商渠道
 * @param data
 */
export const updateLogisticsChannel = (data: LogisticsChannelForm) => {
  return request({
    url: '/amz/logisticsChannel',
    method: 'put',
    data: data
  });
};

/**
 * 删除物流商渠道
 * @param id
 */
export const delLogisticsChannel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/amz/logisticsChannel/' + id,
    method: 'delete'
  });
};
