import { getCommissionRequestById } from "@/actions/commissions/requests/getCommissionRequestById";
import { CommissionRequestEditor } from "@/components/commissions/requests/CommissionRequestEditor";
import { notFound } from "next/navigation";

// Admin page for editing a single commission request.
export default async function CommissionRequestPage({
  params,
}: {
  params: { id: string };
}) {
  const { id } = await params;
  const request = await getCommissionRequestById(id);
  if (!request) notFound();

  return (
    <div className="space-y-8">
      <div className="flex flex-col gap-4">
        <div>
          <h1 className="text-2xl font-semibold">Commission Request</h1>
          <p className="text-sm text-muted-foreground">
            Submitted: {new Date(request.createdAt).toLocaleString()} · ID: {request.id}
          </p>
        </div>
        <CommissionRequestEditor request={request} />
      </div>
    </div>
  );
}
