import { useAuth } from '../auth/useAuth';
import { Navigate } from 'react-router';

export function DeniedPage() {
  const { user, logout } = useAuth();

  if (!user) return <Navigate to="/login" replace />;
  if (user.status === 'ACTIVE') return <Navigate to="/" replace />;

  return (
    <div className="min-h-screen bg-bg-primary flex items-center justify-center px-4">
      <div className="bg-surface rounded-2xl shadow-lg p-10 max-w-md w-full text-center">
        <div className="w-16 h-16 bg-red-100 rounded-full mx-auto mb-4 flex items-center justify-center">
          <svg className="w-8 h-8 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" />
          </svg>
        </div>
        <h1 className="text-xl font-bold text-text-primary mb-2">접근이 거부되었습니다</h1>
        <p className="text-text-muted text-sm mb-6">
          계정이 {user.status === 'REJECTED' ? '거절' : '비활성화'}되었습니다.
          <br />
          관리자에게 문의하세요.
        </p>
        <button
          onClick={logout}
          className="text-sm text-link hover:text-accent-hover cursor-pointer"
        >
          다른 계정으로 로그인
        </button>
      </div>
    </div>
  );
}
