import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/SupportService";
import { CreatePlanType } from "../types/SupportTypes";

export const useCreateSupport = () => {
  return useMutation({
    mutationFn: (variables: CreatePlanType) => api.createPlan(variables),
  });
};

export const useGetPlans = () => {
  return useQuery({
    queryKey: ["plans"],
    queryFn: () => api.getPlans(),
  });
};

export const useGetPlanById = (id: string) => {
  return useQuery({
    queryKey: ["plan", id],
    queryFn: () => api.getPlanById(id),
  });
};
