import type { SearchParams } from 'nuqs/server';
import PageContainer from '@/components/layout/page-container';
import { requireSuperAdminDashboardAccess } from '@/lib/auth/page-guards';
import { searchParamsCache } from '@/lib/searchparams';
import PermissionAuditLogListing from '@/features/permission-management/components/permission-audit-log-listing';

export const metadata = {
  title: 'Dashboard: Permission Audit Logs'
};

type PageProps = {
  searchParams: Promise<SearchParams>;
};

export default async function PermissionAuditLogsPage(props: PageProps) {
  await requireSuperAdminDashboardAccess();

  const searchParams = await props.searchParams;
  searchParamsCache.parse(searchParams);

  return (
    <PageContainer
      pageTitle='Permission Audit Logs'
      pageDescription='ติดตามการสร้าง แก้ไข assign และ override สิทธิ์ทั้งหมด'
    >
      <PermissionAuditLogListing />
    </PageContainer>
  );
}
