{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/realpkuasule/harness-automation/main/docs/api/worktree-adopt-v1.schema.json",
  "title": "Harness Worktree Adoption Manifest v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "items"],
  "properties": {
    "schemaVersion": {
      "const": "worktree-adopt/1.0"
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/item"
      }
    }
  },
  "$defs": {
    "item": {
      "type": "object",
      "additionalProperties": false,
      "required": ["workItem", "owner", "path", "branch"],
      "properties": {
        "workItem": {
          "type": "string",
          "minLength": 1,
          "pattern": ".*\\S.*"
        },
        "owner": {
          "type": "string",
          "minLength": 1,
          "pattern": ".*\\S.*"
        },
        "thread": {
          "type": "string",
          "minLength": 1,
          "pattern": ".*\\S.*"
        },
        "path": {
          "type": "string",
          "minLength": 1,
          "pattern": "^(?:/|[A-Za-z]:[\\\\/]|\\\\\\\\)",
          "description": "Absolute path of an already registered persistent worktree."
        },
        "branch": {
          "type": "string",
          "minLength": 1,
          "pattern": ".*\\S.*"
        }
      }
    }
  }
}
