import { RecipientService } from "@/services/recipient.service"

import RecipientForm from "../../_components/recipient.form"

export default async function RecipientEditPage({
  params,
}: {
  params: Promise<{ recipientId: string }>
}) {
  const { recipientId } = await params
  const recipient = await RecipientService.findById(recipientId)

  if (!recipient) {
    return <div>Recipient not found</div>
  }

  return (
    <div className="flex flex-col gap-4">
      <div className="flex items-center justify-between gap-4">
        <h1 className="text-2xl font-bold">Edit Recipient</h1>
      </div>
      <RecipientForm initialData={recipient} mode="edit" />
    </div>
  )
}
