"""Schemas for the Implementation Playbook renderer.

A Playbook is a *derived view* (computed-not-stored): it assembles, for one capability, the full
"wie komme ich dort hin?" journey from (a) curated playbook KNOWLEDGE, (b) the regulatory leverage
(which regulations a delivered capability closes), and (c) injected Procedure/Control/Evidence links
(Execution-owned). Nothing here is persisted. No new meta-model class, no graph (freeze v1.0).
Python 3.9 compatible (no `|` unions).
"""

from __future__ import annotations

from typing import List

from pydantic import BaseModel, Field


class PlaybookStep(BaseModel):
    """One step in the recommended way to stand up a capability."""

    order: int
    title: str
    detail: str = ""


class Playbook(BaseModel):
    """The complete implementation journey for ONE capability — the Berater view.

    Answers, in order: Warum? -> Welche Regelwerke schliesst das? -> Welche Tools? -> Welche
    Prozesse? -> Welche Nachweise? -> Welche Controls? The curated parts (why/tools/steps/evidence/
    how-others) are an EXPERT DRAFT, not a normative requirement; controls are injected from
    Execution (may be empty until linked).
    """

    capability_id: str
    title: str = ""
    why: str = ""                                          # why this is required (regulatory rationale)
    closes_regulations: List[str] = Field(default_factory=list)   # leverage: regulations a delivered cap closes
    leverage: int = 0                                      # = len(closes_regulations)
    tools: List[str] = Field(default_factory=list)         # typical tooling (curated knowledge)
    process_steps: List[PlaybookStep] = Field(default_factory=list)   # how to stand it up
    expected_evidence: List[str] = Field(default_factory=list)        # artifacts that prove it
    controls: List[str] = Field(default_factory=list)      # control refs (injected from Execution; may be empty)
    how_others_do_it: str = ""                             # "wie machen das andere?" (curated)
    status: str = "draft"                                  # draft -> reviewed -> validated -> proven
    disclaimer: str = ""                                   # expert draft, not a normative requirement
