{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://otov7.com/schemas/demo-scenario-manifest-1.0.0.json",
  "title": "OTO · Manifeste Scénarios démo (run-sheet)",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "deliverable", "sprint", "roadmap_ref", "generated_from",
    "deliverables_root", "self_module", "generated_at", "scenarios",
    "counts", "modules_cites", "couverture_ci", "pret"
  ],
  "properties": {
    "deliverable": {"type": "string", "minLength": 1},
    "sprint": {"type": "string", "minLength": 1},
    "roadmap_ref": {"type": "string", "minLength": 1},
    "generated_from": {"type": "string", "const": "scenario_spec.json"},
    "deliverables_root": {"type": "string", "const": "05_deliverables_mvp"},
    "self_module": {"type": "string", "const": "demo/scenarios"},
    "generated_at": {"type": ["string", "null"]},
    "scenarios": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "projet", "audience", "beats", "citations",
                     "citations_resolues", "duree_min", "modules_cites"],
        "properties": {
          "id": {"type": "string", "pattern": "^S-P0[1-9]-[A-Z]+$"},
          "projet": {"type": "string", "pattern": "^P0[1-9]$"},
          "audience": {"type": "string", "enum": ["banquier", "client"]},
          "beats": {"type": "integer", "minimum": 3},
          "citations": {"type": "integer", "minimum": 1},
          "citations_resolues": {"type": "integer", "minimum": 0},
          "duree_min": {"type": "integer", "minimum": 1},
          "modules_cites": {
            "type": "array", "minItems": 2, "uniqueItems": true,
            "items": {"type": "string", "minLength": 1}
          }
        }
      }
    },
    "counts": {
      "type": "object",
      "additionalProperties": false,
      "required": ["scenarios", "beats_total", "citations_total",
                   "citations_non_resolues", "modules_cites_uniques"],
      "properties": {
        "scenarios": {"type": "integer", "minimum": 1},
        "beats_total": {"type": "integer", "minimum": 1},
        "citations_total": {"type": "integer", "minimum": 1},
        "citations_non_resolues": {"type": "integer", "minimum": 0},
        "modules_cites_uniques": {"type": "integer", "minimum": 1}
      }
    },
    "modules_cites": {
      "type": "array", "minItems": 1, "uniqueItems": true,
      "items": {"type": "string", "minLength": 1}
    },
    "couverture_ci": {
      "type": "object",
      "additionalProperties": false,
      "required": ["ok", "modules_cites_non_gated"],
      "properties": {
        "ok": {"type": "boolean"},
        "modules_cites_non_gated": {
          "type": "array", "items": {"type": "string", "minLength": 1}
        }
      }
    },
    "pret": {"type": "boolean"}
  }
}
