/* global React, ReactDOM, window */
// F-22 (ADR-0028) · Phase 8 fix-cycle response to Codex [MUST-FIX:M-1-1]:
// Externalized from inline `<script type="text/babel">` in index.html so that
// a future `/b2b` CSP exception needs only `script-src 'self' 'unsafe-eval'`
// (Babel standalone runtime) and not `'unsafe-inline'`. Behaviour unchanged.
(function () {
  const { useState } = React;
  const GNB = window.VHB_GNB;
  const DemoFlow = window.VHB_DemoFlow;
  const KanbanPage = window.VHB_KanbanPage;
  const PipelinePage = window.VHB_PipelinePage;
  const NewsletterPage = window.VHB_NewsletterPage;
  const StubPage = window.VHB_StubPage;

  function App() {
    const [tab, setTab] = useState('demo');
    return (
      <>
        <GNB tab={tab} setTab={setTab} />
        <main className="vhb-page" data-screen-label={`${tab}`}>
          {tab === 'demo' && <DemoFlow />}
          {tab === 'kanban' && <KanbanPage />}
          {tab === 'pipeline' && <PipelinePage />}
          {tab === 'newsletter' && <NewsletterPage />}
          {tab === 'resume' && <StubPage
            title="이력서 분석"
            body="구직자가 업로드한 업무 산출물을 바탕으로 Best Version 이력서를 생성·검토하는 화면입니다. 본 데모는 B2B 채용 회사 시점으로 구성되어 있어, 이력서 분석 UI는 별도 화면(랜딩/업로드)에서 확인하실 수 있습니다."
          />}
          {tab === 'workbench' && <StubPage
            title="워크벤치"
            body="채용 담당자의 일상 작업 공간 — 진행 중 포지션, 즉시 검토할 후보자, 최근 메모를 한 화면에 모읍니다. 데모 워크벤치에서 흐름을 먼저 살펴보세요."
          />}
        </main>
      </>
    );
  }

  const root = ReactDOM.createRoot(document.getElementById('root'));
  root.render(<App />);
})();
