{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.kxm.dev/lanes.schema.json",
  "title": "KXM worktree lanes",
  "type": "object",
  "required": ["schema", "lanes"],
  "additionalProperties": false,
  "properties": {
    "schema": {
      "const": "kxm.lanes.v1"
    },
    "lanes": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$"
      },
      "patternProperties": {
        "^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$": {
          "$ref": "#/$defs/lane"
        }
      },
      "additionalProperties": false
    }
  },
  "$defs": {
    "lane": {
      "type": "object",
      "required": ["path", "branch", "baseRef", "baseSha", "createdAt"],
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "branch": {
          "type": "string",
          "minLength": 1
        },
        "baseRef": {
          "type": "string",
          "minLength": 1
        },
        "baseSha": {
          "type": "string",
          "pattern": "^[a-f0-9]{40,64}$"
        },
        "createdAt": {
          "type": "string",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]{1,9})?Z$"
        },
        "lastRunId": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
