import React from "react";
import { openMasterDashboard } from "../config/satPortal.js";
import { useAuth } from "../context/AuthContext.jsx";

/** Shown when user has HSE SSO but is not Admin (SWI admin is admin-only for now). */
export default function AccessDeniedPage() {
  const { logout } = useAuth();

  return (
    <div className="swi-login-page">
      <div className="swi-login-card">
        <h1 className="swi-login-title">Admin access required</h1>
        <p className="swi-login-subtitle">
          SWI document management is available to Admin users. Open the HSE
          Master Dashboard and sign in with an Admin account, then launch SWI
          from the applications list.
        </p>
        <div className="swi-form-actions swi-form-actions--stack">
          <button
            type="button"
            className="swi-btn swi-btn--primary"
            onClick={() => openMasterDashboard()}
          >
            Go to Master Dashboard
          </button>
          <button type="button" className="swi-btn swi-btn--ghost" onClick={logout}>
            Sign out (HSE login)
          </button>
        </div>
      </div>
    </div>
  );
}
