import { apiWorker } from './api';

export const getCategoryTree = async () => {
  return (await apiWorker.get('/shopee/category/getCategoryTree')).data;
};

export const getCategoryList = async () => {
  return (await apiWorker.get('/shopee/category/getCategoryList')).data;
};

/**
 *
 * @param {string[]} listCategoryId
 * @param {number} page
 * @param {number} limit
 * @returns {Promise<Array>}
 */
export const fetchListProductCategoryId = async (listCategoryId, page = 0, limit = 100) => {
  return (await apiWorker.post('/shopee/product/fetchProductListCategoryId', {
    listCategoryId,
    limit,
    page,
  })).data;
};

/**
 *
 * @param {string[]} listShopId
 * @param {number} page
 * @param {number} limit
 * @returns {Promise<Array>}
 */
export const fetchListProductShopId = async (listShopId, page = 0, limit = 100) => {
  return (await apiWorker.post('/shopee/product/fetchProductListShopId', {
    listShopId,
    limit,
    page,
  })).data;
};
