// BlueprintReportPillars.jsx
// 5 × pillar analysis pages (Current / Target / Gaps / Actions)
// Pillar openers come from BlueprintReport.jsx <PillarOpener/>

function PillarAnalysis({ num, title, score, max, page, total, current, target, gaps, actions }) {
  return (
    <window.ReportPage page={page} total={total} headerRight={`Pillar ${String(num).padStart(2, "0")} · Analysis`}>
      <div className="rp-panal">
        <div className="rp-panal__head">
          <div>
            <div className="rp-section-eyebrow">Pillar {String(num).padStart(2, "0")} · {title}</div>
            <h2>Current state, target state, gaps, <em>actions</em><i className="stop">.</i></h2>
          </div>
          <div className="rp-panal__pillscore">
            Score<br/>
            <b>{score}</b> <span style={{color: "var(--t-ink-3)"}}>/ {max}</span>
          </div>
        </div>

        <div className="rp-panal__grid">
          <div className="rp-panal__cell">
            <div className="rp-panal__cell-eyebrow">Current state · 9 April 2026</div>
            <div className="rp-panal__cell-body" dangerouslySetInnerHTML={{__html: current}}></div>
          </div>
          <div className="rp-panal__cell rp-panal__cell--target">
            <div className="rp-panal__cell-eyebrow">Target · April 2027</div>
            <div className="rp-panal__cell-body" dangerouslySetInnerHTML={{__html: target}}></div>
          </div>
          <div className="rp-panal__cell">
            <div className="rp-panal__cell-eyebrow">Gaps</div>
            <ul className="rp-list" style={{margin: 0}}>
              {gaps.map((g, i) => <li key={i} dangerouslySetInnerHTML={{__html: g}}></li>)}
            </ul>
          </div>
          <div className="rp-panal__cell">
            <div className="rp-panal__cell-eyebrow">Actions</div>
            <ul className="rp-list" style={{margin: 0}}>
              {actions.map((a, i) => <li key={i} dangerouslySetInnerHTML={{__html: a}}></li>)}
            </ul>
          </div>
        </div>
      </div>
    </window.ReportPage>
  );
}

// Pillar 1, Assess
function P1_Analysis() {
  return <PillarAnalysis
    num={1} title="Assess" score={2} max={8} page={13} total={37}
    current={"Hartwell has no formal AI usage register. Copilot in Outlook is enabled but unmeasured. ChatGPT is used informally for marketing captions. No baseline metrics, no measurement, no inventory of where AI could plausibly be used in the business."}
    target={"A single one-page <strong>AI Register</strong> reviewed quarterly. Lists every AI tool in use, who owns it, what it costs, and what it returned. Sits alongside the IT inventory."}
    gaps={[
      "No view of what staff are using AI for already (shadow AI is significant, see <strong>Section 06</strong>).",
      "No measurement of time saved or value created by current Copilot use.",
      "No inventory of work that could plausibly be AI-assisted but is not yet."
    ]}
    actions={[
      "<strong>Month 1.</strong> Run a one-week shadow AI survey across all 28 staff. No judgement, no policing, just inventory.",
      "<strong>Month 2.</strong> Stand up the AI Register as a single shared spreadsheet. Sarah owns it.",
      "<strong>Month 3.</strong> First quarterly review at the leadership meeting. Establish the cadence."
    ]}
  />;
}

// Pillar 2, Prioritise
function P2_Analysis() {
  return <PillarAnalysis
    num={2} title="Prioritise" score={3} max={12} page={15} total={37}
    current={"Decisions about new tools are made reactively, most recently the Microsoft 365 upgrade in November 2025, which was driven by a vendor email. No structured way to weigh AI use cases against each other or against the year's other investments."}
    target={"A <strong>Use Case Backlog</strong> in the Operations folder, scored against value, feasibility, and time-to-value. Reviewed monthly by Sarah. Anyone in the business can add an idea via a one-page form."}
    gaps={[
      "No agreed scoring method.",
      "No place where ideas are kept once raised; good ideas have died in WhatsApp threads.",
      "Difficulty judging vendor claims (the Ibcos AI add-on is a current example, sales pitch arrived in March 2026)."
    ]}
    actions={[
      "<strong>Month 2.</strong> Adopt the value × feasibility × time-to-value framework from <strong>Section 04</strong> as Hartwell's standard.",
      "<strong>Month 2.</strong> Stand up the backlog. Pre-populate with the 11 ideas raised in the Blueprint Day.",
      "<strong>Ongoing.</strong> Monthly review at Tuesday operations meeting, first item on the agenda."
    ]}
  />;
}

// Pillar 3, Govern
function P3_Analysis() {
  return <PillarAnalysis
    num={3} title="Govern" score={3} max={8} page={17} total={37}
    current={"No written AI policy. No data-handling guidance for staff using AI tools. No customer-facing identification when AI drafts a response (none are sent today; risk emerges in Phase 1). GDPR posture is sound on the IT side; AI side is unaddressed."}
    target={"A <strong>1-page AI policy</strong> covering allowed tools, prohibited inputs, customer identification, escalation, and review cadence. Read and signed by every staff member at induction. The Bounded AI principle is the document's spine."}
    gaps={[
      "No policy document.",
      "No staff training on what is safe to put into ChatGPT (currently: anything).",
      "No identification standard for when AI drafts customer-facing content."
    ]}
    actions={[
      "<strong>Month 1.</strong> MoonBoots drafts the AI policy from a tested SME template; Robert reviews; Sarah owns enforcement.",
      "<strong>Month 2.</strong> All-hands 30-min session walking through the policy. Q&A. Signed acknowledgement.",
      "<strong>Month 3.</strong> Built into the new-starter induction pack alongside H&S and IT."
    ]}
  />;
}

// Pillar 4, Deploy
function P4_Analysis() {
  return <PillarAnalysis
    num={4} title="Deploy" score={3} max={8} page={19} total={37}
    current={"No AI workflow has been deployed and supported in production. Copilot in Outlook is the closest thing, switched on by Microsoft, used inconsistently, no rollout plan. The team has zero experience of building, training on, and supporting an AI tool."}
    target={"<strong>Three production AI workflows</strong> deployed across 12 months: Service Copilot (Phase 1), After-Hours Enquiry Handler (Phase 2), Sales Pipeline Intelligence (Phase 3). Each with named owner, training, monitoring, and quarterly review."}
    gaps={[
      "No deployment experience to draw on.",
      "Mike Pollard is the only natural technical owner and is already overstretched (see <strong>Pillar 03, Govern</strong>).",
      "Tablet hardware not standardised across the four depots."
    ]}
    actions={[
      "<strong>Months 1 to 3.</strong> Service Copilot build, training, and 30-day support window (see Use Case 01, page 24).",
      "<strong>Months 4 to 6.</strong> Phase 2 build with named champion in each depot.",
      "<strong>Months 7 to 12.</strong> Phase 3 build, only after Phases 1 to 2 are stable for 60 days."
    ]}
  />;
}

// Pillar 5, Evolve
function P5_Analysis() {
  return <PillarAnalysis
    num={5} title="Evolve" score={5} max={12} page={21} total={37}
    current={"AI tools currently in use are static, Copilot is whatever Microsoft ships. No mechanism for capturing what works, what does not, what to retire. No feedback loop from staff into the use case backlog."}
    target={"<strong>Quarterly AI review</strong> as a standing agenda item. Staff feedback channel (a single Teams channel, monitored by Sarah). Vendor catalogue updated annually. The 12-month plan ends with a refreshed Blueprint, not a static document."}
    gaps={[
      "No feedback channel.",
      "No retirement criteria, Hartwell has never decommissioned a tool.",
      "No annual planning rhythm tied to AI."
    ]}
    actions={[
      "<strong>Month 4.</strong> Stand up the staff feedback channel.",
      "<strong>Month 6.</strong> First quarterly AI review. Set the retirement criteria.",
      "<strong>Month 12.</strong> MoonBoots returns for a half-day Blueprint refresh, included in the Phase 3 fixed price."
    ]}
  />;
}

window.P1_Analysis = P1_Analysis;
window.P2_Analysis = P2_Analysis;
window.P3_Analysis = P3_Analysis;
window.P4_Analysis = P4_Analysis;
window.P5_Analysis = P5_Analysis;
