"use client"

import { useEffect } from "react"
import Link from "next/link"
import { Button } from "@/components/ui/button"
import { ShieldX } from "lucide-react"

export default function Error({
  error,
  reset,
}: {
  error: Error & { digest?: string }
  reset: () => void
}) {
  useEffect(() => {
    // Log the error to an error reporting service
    console.error(error)
  }, [error])

  return (
    <div className="flex min-h-[70vh] flex-col items-center justify-center text-center">
      <ShieldX className="h-20 w-20 text-destructive" />
      <h1 className="mt-6 text-3xl font-bold sm:text-5xl">Something went wrong</h1>
      <p className="mt-4 max-w-md text-muted-foreground">
        Our quantum verification system encountered an unexpected error. Our team has been notified.
      </p>
      <div className="mt-8 flex gap-4">
        <Button onClick={reset} variant="outline">
          Try again
        </Button>
        <Button asChild>
          <Link href="/">Return to Home</Link>
        </Button>
      </div>
    </div>
  )
}
