{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://local/harness/preset.schema.json",
  "title": "Harness seat-binding preset",
  "description": "A named, reusable map of seat -> engine binding with bounded ordered fallback chains.",
  "type": "object",
  "additionalProperties": false,
  "required": ["name", "version", "seats"],
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]*$",
      "description": "Preset id, kebab-case. e.g. anthropic, anthropic-less, cursor, codex."
    },
    "version": { "const": "preset/v1" },
    "description": { "type": "string" },
    "seats": {
      "type": "object",
      "description": "seat name -> binding. Seat names are an OPEN enum (coder, reviewer, fixer, resolver, gate, planner, ...). The harness does not hardcode the set; plan nodes reference seats and presets bind them.",
      "minProperties": 1,
      "additionalProperties": {
        "oneOf": [
          { "$ref": "#/$defs/binding" },
          { "$ref": "#/$defs/tieredBinding" }
        ]
      }
    }
  },
  "$defs": {
    "binding": {
      "type": "object",
      "additionalProperties": false,
      "required": ["wrapper"],
      "description": "One concrete engine binding. wrapper MUST satisfy WRAPPER-CONTRACT.md.",
      "properties": {
        "wrapper": {
          "type": "string",
          "description": "Path to the engine wrapper script (relative to ~/.claude or absolute). e.g. skills/north-orchestrator/na.sh"
        },
        "model": {
          "type": "string",
          "description": "Model id passed as --model. Required for any engine that accepts a model — NEVER rely on the engine's interactive default."
        },
        "provider": {
          "type": "string",
          "minLength": 1,
          "description": "Provider identity used for reviewer independence. Omit only when wrapper path is the provider identity."
        },
        "timeout": {
          "type": "integer",
          "minimum": 1,
          "description": "Seconds; passed as --timeout. Omit to use the wrapper default."
        },
        "fallback": { "$ref": "#/$defs/fallback" }
      }
    },
    "tieredBinding": {
      "type": "object",
      "additionalProperties": false,
      "minProperties": 1,
      "properties": {
        "low": { "$ref": "#/$defs/binding" },
        "medium": { "$ref": "#/$defs/binding" },
        "high": { "$ref": "#/$defs/binding" }
      }
    },
    "fallbackReference": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]+(?:\\.(?:low|medium|high))?$",
      "description": "Seat reference or explicit seat tier, for example reviewer or coder.medium."
    },
    "fallback": {
      "oneOf": [
        { "$ref": "#/$defs/fallbackReference" },
        { "$ref": "#/$defs/binding" },
        {
          "type": "array",
          "minItems": 1,
          "maxItems": 3,
          "items": {
            "oneOf": [
              { "$ref": "#/$defs/fallbackReference" },
              { "$ref": "#/$defs/binding" }
            ]
          }
        }
      ]
    }
  }
}
