import { ConfigFormItem } from "@/components/forms/configs/ConfigsForm";
import { getAllConfigs, updateAllConfigs } from "@/service/apis/configs";
import { ServerResponse } from "@/types";
import { useMutation, useQuery } from "@tanstack/react-query";

export const useGetAllConfigs = () =>
  useQuery({
    queryKey: ["get-all-configs"],
    queryFn: () => getAllConfigs(),
    retry: false,
    refetchOnWindowFocus: false,
  });

export const useUpdateConfigs = () =>
  useMutation<ServerResponse, Error, ConfigFormItem[], ServerResponse>({
    mutationFn: updateAllConfigs,
  });
