{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "CI XP window attributes snapshot 1.1.0",
  "description": "Producer schema. Consumers ignore unknown fields and treat invalid optional fields as absent rather than rejecting the whole host state.",
  "type": "object",
  "required": [
    "schema",
    "version",
    "programs"
  ],
  "properties": {
    "schema": {
      "const": "ci-xp-window-attributes/v1"
    },
    "version": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$"
    },
    "session_role": {
      "$ref": "#/$defs/token"
    },
    "programs": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,99}$"
      },
      "additionalProperties": {
        "type": "object",
        "properties": {
          "app_type": {
            "$ref": "#/$defs/token"
          },
          "app_role": {
            "$ref": "#/$defs/token"
          },
          "app_role_source": {
            "enum": [
              "desktop",
              "public"
            ]
          }
        },
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": true,
  "$defs": {
    "token": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{0,47}$"
    }
  }
}
