import { AdminPermissionGate } from "@/components/admin/admin-permission-gate";
import { ModuleScaffold } from "@/components/admin/module-scaffold";
import { PRD_TICKETS_ACCESS_ANY } from "@/lib/admin-prd";
import { TicketDetailConsole } from "@/modules/tickets/ticket-detail-console";
import { buildPageMetadata } from "@/lib/page-metadata";
import type { Metadata } from "next";

export const metadata: Metadata = buildPageMetadata("tickets", "detailTitle");

export default async function AdminTicketDetailPage(props: {
  params: Promise<{ ticketNo: string }>;
}) {
  const { ticketNo } = await props.params;

  return (
    <ModuleScaffold>
      <AdminPermissionGate requiredAny={PRD_TICKETS_ACCESS_ANY}>
        <TicketDetailConsole ticketNo={decodeURIComponent(ticketNo)} />
      </AdminPermissionGate>
    </ModuleScaffold>
  );
}
