{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "PersonaDef": {
      "type": "object",
      "properties": {
        "role": { "type": "string" },
        "mandate": {
          "oneOf": [
            { "type": "string" },
            { "type": "array", "items": { "type": "string" } }
          ]
        },
        "checklist": {
          "type": "object",
          "patternProperties": {
            "^.*$": {
              "oneOf": [
                { "type": "string" },
                { "type": "array", "items": { "type": "string" } }
              ]
            }
          }
        }
      },
      "required": ["role", "mandate", "checklist"]
    },
    "EnvironmentDef": {
      "type": "object",
      "properties": {
        "vcs": { "type": "string", "enum": ["GIT", "JJ"] },
        "harness": { "type": "string", "enum": ["JETSKI", "GENERIC_CLI"] },
        "temp_directory": {
          "type": "string",
          "description": "The relative path (recommended for workspace isolation) or absolute path to a directory where interim files are stored."
        }
      },
      "required": ["vcs", "harness", "temp_directory"]
    },
    "ProjectSpec": {
      "type": "object",
      "properties": {
        "target_skill": {
          "type": "string",
          "description": "Path to the skill directory to train."
        },
        "feedback_file": {
          "type": "string",
          "description": "Path to the JSON file containing the feedback/constraints (required for BASIC_PATH)."
        },
        "target_files_to_analyze": {
          "type": "array",
          "items": { "type": "string" },
          "description": "List of product files to mine Gerrit review comments from (DEEP_PATH)."
        },
        "cl_to_analyze": {
          "type": "string",
          "description": "Specific Gerrit CL number to fetch comments from (DEEP_PATH)."
        },
        "target_component": {
          "type": "string",
          "description": "Path to the component directory to analyze (e.g., 'content/browser/renderer_host') (BREADTH_PATH)."
        },
        "breadth_strategies": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["STATIC_ARCH", "CL_SAMPLING", "CONSUMER_USAGE"]
          },
          "description": "Strategies to execute for BREADTH_PATH."
        },
        "environment": { "$ref": "#/definitions/EnvironmentDef" },
        "active_protocol": {
          "type": "string",
          "enum": ["WORKFLOW", "TDD", "REVIEW"],
          "description": "Identifies the active protocol."
        }
      },
      "required": ["target_skill", "environment", "active_protocol"],
      "oneOf": [
        { "required": ["feedback_file"] },
        { "required": ["target_files_to_analyze"] },
        { "required": ["cl_to_analyze"] },
        { "required": ["target_component"] }
      ]
    }
  }
}
