import { useQuery } from "@tanstack/react-query";

import { bookingsService } from "../services/bookings.service";

export const useBookings = () =>
  useQuery({
    queryKey: ["bookings"],
    queryFn: bookingsService.list,
  });

export const useBooking = (id: string) =>
  useQuery({
    queryKey: ["bookings", id],
    queryFn: () => bookingsService.get(id),
    enabled: Boolean(id),
  });
