'use client'

import React from 'react'
import { Button } from '@/components/ui/button'
import { signOut } from 'next-auth/react'
import { useRouter } from 'next/navigation'

export default function ForbiddenPage() {
  const router = useRouter()
  return (
      <div className="flex flex-col items-center justify-center h-full">
        <h1 className="text-3xl font-bold mb-4">403 权限不足</h1>
        <p className="mb-6">您没有访问此页面的权限。您可以尝试重新登录或联系系统管理员。</p>
        <Button
          onClick={async() => {
            // 重定向到登录页
            await signOut({ redirect: false })
            router.push('/login')
          }}
          className="px-4 py-2 bg-primary text-white rounded"
        >
          返回登录
        </Button>
      </div>
  )
}