import { GetEtcAPI } from "@/type/wwwAPI";
import { wwwAPI } from "@/utilities/wwwAPI";
import { useQuery } from "@tanstack/react-query";
import { useIsPath } from "taehui-lib/fe-utilities";
import { useLanguage } from "taehui-lib/language";

export default function useGetEtc() {
  const isPath = useIsPath();
  const language = useLanguage();

  return useQuery({
    enabled: isPath("/etc"),
    queryKey: ["etc", language],
    queryFn: async () => {
      const { data } = await wwwAPI.get<GetEtcAPI>("/etc", {
        params: { language },
      });
      return data;
    },
    initialData: {
      totalDateSet: [],
      totalDateValues: [],
      enrollDateSet: [],
      enrollDateValues: [],
      avatarDateSet: [],
      avatarDateValues: [],
      totalNoteFiles: [],
      totalTitles: [],
      totalEdges: [],
      favorites: [],
      favoritesAt: [],
      inputModes: [],
      autoModes: [],
      noteSaltModes: [],
      faintNoteModes: [],
      judgmentModes: [],
      hitPointsModes: [],
      noteMobilityModes: [],
      longNoteModes: [],
      inputFavorModes: [],
      noteModifyModes: [],
      lowestJudgmentConditionModes: [],
    },
  });
}
