import { useQuery } from "@tanstack/react-query";
import {
  getPersonalDetailsMasters,
  getEducationMasters,
  getEducationList,
  getFamilyMasters,
  getLifestyleMasters,
  getPartnerPreferenceMasters,
} from "../api/masters.api";

/** Personal details master */
export const usePersonalMasters = () =>
  useQuery({
    queryKey: ["personal-masters"],
    queryFn: getPersonalDetailsMasters,
  });

/** Education master */
export const useEducationMasters = () =>
  useQuery({
    queryKey: ["education-masters"],
    queryFn: getEducationMasters,
  });

export const useEducationList = (studyFieldId) =>
  useQuery({
    queryKey: ["education-list", studyFieldId],
    queryFn: () => getEducationList(studyFieldId),
    enabled: Boolean(studyFieldId),
  });

/** Family master */
export const useFamilyMasters = () =>
  useQuery({
    queryKey: ["family-masters"],
    queryFn: getFamilyMasters,
  });

/** Lifestyle master */
export const useLifestyleMasters = () =>
  useQuery({
    queryKey: ["lifestyle-masters"],
    queryFn: getLifestyleMasters,
  });

/** Partner preference master */
export const usePartnerPreferenceMasters = () =>
  useQuery({
    queryKey: ["partner-masters"],
    queryFn: getPartnerPreferenceMasters,
  });
