'use client';

import { useEffect } from 'react';
import { useTranslations } from 'next-intl';

export default function ErrorPage({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  const t = useTranslations('errors');

  useEffect(() => {
    console.error(error);
  }, [error]);

  return (
    <main className="flex min-h-screen flex-col items-center justify-center gap-4 p-6 text-center">
      <h1 className="text-4xl font-bold">{t('title500')}</h1>
      <p className="text-muted-foreground">{t('message500')}</p>
      <button onClick={reset} className="text-sm underline underline-offset-4">
        {t('retry')}
      </button>
    </main>
  );
}
