import axios from "axios";

/**
 * Fetch out-province carcass buyers (real persons - حقیقی)
 * @param {Object} params - Query parameters
 * @param {string} params.role - User role
 * @param {number} params.page - Page number
 * @param {number} params.pageSize - Items per page
 * @param {string} params.searchValue - Search value
 * @param {string} params.buyerType - buyer type
 * @returns {Promise} Axios promise with buyers data
 */
export const fetchOutProvinceRealBuyers = async ({
  role,
  page,
  pageSize,
  searchValue = "",
  buyer_type = "",
}) => {
  const response = await axios.get(
    `out-province-carcasses-buyer/?search=filter&value=${searchValue}&role=${role}&page=${page}&page_size=${pageSize}&state=buyer-list&type=real${
      buyer_type ? "&buyer_type=" + buyer_type : ""
    }`
  );
  return response;
};

/**
 * Fetch out-province carcass buyers (legal entities - حقوقی)
 * @param {Object} params - Query parameters
 * @param {string} params.role - User role
 * @param {number} params.page - Page number
 * @param {number} params.pageSize - Items per page
 * @param {string} params.searchValue - Search value
 * @returns {Promise} Axios promise with buyers data
 */
export const fetchOutProvinceLegalBuyers = async ({
  role,
  page,
  pageSize,
  searchValue = "",
  buyer_type = "",
}) => {
  const response = await axios.get(
    `out-province-carcasses-buyer/?search=filter&value=${searchValue}&role=${role}&page=${page}&page_size=${pageSize}&state=buyer-list&type=legal${
      buyer_type ? "&buyer_type=" + buyer_type : ""
    }`
  );
  return response;
};
