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
 * @returns {Promise} Axios promise with buyers data
 */
export const fetchOutProvinceRealBuyers = async ({
  role,
  page,
  pageSize,
  searchValue = "",
}) => {
  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`
  );
  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 = "",
}) => {
  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`
  );
  return response;
};

