{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Game-library extraction output",
  "description": "One subagent output file: a header carrying provenance/version metadata plus the list of activities extracted from a single chunk.",
  "type": "object",
  "required": ["header", "activities"],
  "additionalProperties": false,
  "properties": {
    "header": {
      "type": "object",
      "required": ["source_hash", "schema_version", "prompt_version", "chunk_range"],
      "additionalProperties": true,
      "properties": {
        "source_hash": {"type": "string", "minLength": 8},
        "schema_version": {"type": "string"},
        "prompt_version": {"type": "string"},
        "chunk_range": {"type": "string"},
        "source_id": {"type": ["string", "null"]},
        "chunk_key": {"type": ["string", "null"]}
      }
    },
    "activities": {
      "type": "array",
      "items": {"$ref": "#/definitions/activity"}
    }
  },
  "definitions": {
    "activity": {
      "type": "object",
      "required": [
        "name",
        "description",
        "category",
        "content_type",
        "language",
        "extraction_confidence",
        "source_excerpt",
        "page_reference"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {"type": "string", "minLength": 3},
        "description": {"type": "string", "minLength": 1},
        "rules": {"type": ["string", "null"]},
        "variations": {"type": ["string", "null"]},
        "category": {
          "type": "string",
          "enum": [
            "jocuri-cercetasesti",
            "team-building",
            "icebreakers",
            "camp-outdoor",
            "wide-games",
            "orientare",
            "prim-ajutor",
            "escape-room-puzzle",
            "creative-stem",
            "sports-active",
            "cantece-ceremonii",
            "retete",
            "supravietuire",
            "integrare-incluziune",
            "conflict-empatie",
            "altele"
          ]
        },
        "subcategory": {"type": ["string", "null"]},
        "content_type": {
          "type": "string",
          "enum": ["joc", "activitate", "reteta", "cantec", "ceremonie"]
        },
        "language": {"type": "string", "enum": ["ro", "en"]},
        "extraction_confidence": {
          "type": "string",
          "enum": ["high", "med", "low"]
        },
        "source_excerpt": {"type": "string", "minLength": 1},
        "page_reference": {"type": "string", "minLength": 1},
        "source_file": {"type": ["string", "null"]},
        "age_group_min": {"type": ["integer", "null"], "minimum": 0},
        "age_group_max": {"type": ["integer", "null"], "minimum": 0},
        "participants_min": {"type": ["integer", "null"], "minimum": 0},
        "participants_max": {"type": ["integer", "null"], "minimum": 0},
        "duration_min": {"type": ["integer", "null"], "minimum": 0},
        "duration_max": {"type": ["integer", "null"], "minimum": 0},
        "materials_category": {"type": ["string", "null"]},
        "materials_list": {
          "type": ["array", "null"],
          "items": {"type": "string"}
        },
        "skills_developed": {
          "type": ["array", "null"],
          "items": {"type": "string"}
        },
        "difficulty_level": {
          "type": ["string", "null"],
          "enum": ["usor", "mediu", "dificil", null]
        },
        "keywords": {
          "type": ["array", "null"],
          "items": {"type": "string"}
        },
        "tags": {
          "type": ["array", "null"],
          "items": {"type": "string"}
        }
      }
    }
  }
}
