import { serverClient } from "@/lib/trpc/server"

import Room from "../Room"

export async function LinkedReservation({
  confirmationNumber,
}: {
  confirmationNumber: string
}) {
  const confirmation = await serverClient().booking.confirmation({
    confirmationNumber,
  })

  const room = confirmation?.room
  const booking = confirmation?.booking

  if (!booking || !room) {
    return <div>Something went wrong, try again</div>
  }

  return <Room booking={booking} img={room.images[0]} roomName={room.name} />
}
