import { useQuery } from '@tanstack/react-query';
import { fetchTicketFormOptions } from '@/features/tickets/services/departmentSupportService';

export const ticketFormOptionsQueryKey = (departmentId: string) =>
  ['departments', departmentId, 'ticket-form-options'] as const;

export function useTicketFormOptions(departmentId: string | undefined) {
  return useQuery({
    queryKey: ticketFormOptionsQueryKey(departmentId ?? ''),
    queryFn: () => fetchTicketFormOptions(departmentId!),
    enabled: Boolean(departmentId),
    staleTime: 60_000,
  });
}
