'use client';

import { ErrorPageContainer } from '@/ui/ErrorPageContainer';
import { ErrorActionButtons } from '@/ui/ErrorActionButtons';
import { Text } from '@/ui/Text';
import { routes } from '@/lib/routing/RouteConfig';
import { useRouter } from 'next/navigation';

export default function ErrorPage({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  const router = useRouter();
  
  return (
    <ErrorPageContainer
      errorCode="Error"
      description={error?.message || 'An unexpected error occurred.'}
    >
      {error?.digest && (
        <Text size="xs" color="text-gray-500" font="mono">
          Error ID: {error.digest}
        </Text>
      )}
      <ErrorActionButtons
        onRetry={reset}
        onHomeClick={() => router.push(routes.public.home)}
        showRetry={true}
      />
    </ErrorPageContainer>
  );
}