import axiosInstance from "./axiosInstance";
import { API_ENDPOINTS } from "./apiEndpoints";

export const getPersonalDetailsMasters = async () => {
  const res = await axiosInstance.get(API_ENDPOINTS.PERSONAL_DETAILS_MASTER);
  return res.data;
};

export const getCasteMasters = async (religion_id) => {
  const res = await axiosInstance.get(API_ENDPOINTS.CASTE_MASTER, {
    params: { religion_id },
  });
  return res.data;
};

export const getSubCasteMasters = async (caste_id) => {
  const res = await axiosInstance.get(API_ENDPOINTS.SUB_CASTE_MASTER, {
    params: { caste_id },
  });
  return res.data;
};

export const getCityMasters = async (state_id) => {
  const params = Array.isArray(state_id)
    ? { state_id: `[${state_id.join(",")}]` }
    : { state_id };
  const res = await axiosInstance.get(API_ENDPOINTS.CITY_MASTER, { params });
  return res.data;
};

export const getStarMasters = async (raasi_id) => {
  const res = await axiosInstance.get(API_ENDPOINTS.STAR_MASTER, {
    params: { raasi_id },
  });
  return res.data;
};

export const getEducationMasters = async () => {
  const res = await axiosInstance.get(API_ENDPOINTS.EDUCATION_DETAILS_MASTER);
  return res.data;
};

export const getEducationList = async (study_field_id) => {
  const res = await axiosInstance.get(API_ENDPOINTS.EDUCATION_LIST_API, {
    params: { study_field_id },
  });
  return res.data;
};

export const getFamilyMasters = async () => {
  const res = await axiosInstance.get(API_ENDPOINTS.FAMILY_DETAILS_MASTER);
  return res.data;
};

export const getLifestyleMasters = async () => {
  const res = await axiosInstance.get(API_ENDPOINTS.LIFESTYLE_DETAILS_MASTER);
  return res.data;
};

export const getPartnerPreferenceMasters = async () => {
  const res = await axiosInstance.get(
    API_ENDPOINTS.PREFERED_PARTNER_DETAILS_MASTER
  );
  return res.data;
};
