import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AmazonStoreVO, AmazonStoreForm, AmazonStoreQuery } from '@/api/amz/amazonStore/types';

/**
 * 查询亚马逊店铺信息列表
 * @param query
 * @returns {*}
 */

export const listAmazonStore = (query?: AmazonStoreQuery): AxiosPromise<AmazonStoreVO[]> => {
  return request({
    url: '/amz/amazonStore/list',
    method: 'get',
    params: query
  });
};

export const collectAmzStoreData = (): void => {
  return request({
    url: '/amz/amazonStore/amz-store',
    method: 'get'
  });
};

/**
 * 查询亚马逊店铺信息详细
 * @param id
 */
export const getAmazonStore = (id: string | number): AxiosPromise<AmazonStoreVO> => {
  return request({
    url: '/amz/amazonStore/' + id,
    method: 'get'
  });
};

/**
 * 新增亚马逊店铺信息
 * @param data
 */
export const addAmazonStore = (data: AmazonStoreForm) => {
  return request({
    url: '/amz/amazonStore',
    method: 'post',
    data: data
  });
};

/**
 * 修改亚马逊店铺信息
 * @param data
 */
export const updateAmazonStore = (data: AmazonStoreForm) => {
  return request({
    url: '/amz/amazonStore',
    method: 'put',
    data: data
  });
};

/**
 * 删除亚马逊店铺信息
 * @param id
 */
export const delAmazonStore = (id: string | number | Array<string | number>) => {
  return request({
    url: '/amz/amazonStore/' + id,
    method: 'delete'
  });
};
