import { getI18n } from '@/lib/i18n/server'
import { ErrorState, LinkButton } from '@/components/ui/display'

/**
 * The "you cannot see this" screen.
 *
 * Rendered when a page's own permission check fails — reachable if someone follows a
 * direct link. It explains the situation and offers a way out rather than a bare 403,
 * and it deliberately reveals nothing about what the page would have contained.
 */
export async function PermissionGate({ home = '/dashboard' }: { home?: string }) {
  const { t } = await getI18n()
  return (
    <ErrorState
      title={t('common.permissionDenied')}
      body={t('common.permissionDeniedBody')}
      action={
        <LinkButton href={home} variant="secondary" size="sm">
          {t('common.back')}
        </LinkButton>
      }
      className="mt-10"
    />
  )
}
