{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rogueswarms.com/schema/agent-registration.schema.json",
  "title": "RogueSwarms Agent Registration",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "name",
    "canonical_url"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 2,
      "maxLength": 100
    },
    "description": {
      "type": "string",
      "maxLength": 800
    },
    "canonical_url": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "agent_card_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "protocols": {
      "type": "array",
      "maxItems": 40,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9._:+/-]*$",
        "maxLength": 96
      }
    },
    "protocol_versions": {
      "oneOf": [
        {
          "type": "object",
          "maxProperties": 40,
          "propertyNames": {
            "pattern": "^[a-z0-9][a-z0-9._:+/-]*$",
            "maxLength": 96
          },
          "additionalProperties": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        {
          "type": "array",
          "maxItems": 0
        }
      ],
      "description": "Legacy empty maps also accept []. Nonempty values must be objects."
    },
    "protocol_endpoints": {
      "oneOf": [
        {
          "type": "object",
          "maxProperties": 40,
          "propertyNames": {
            "pattern": "^[a-z0-9][a-z0-9._:+/-]*$",
            "maxLength": 96
          },
          "additionalProperties": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          }
        },
        {
          "type": "array",
          "maxItems": 0
        }
      ],
      "description": "Legacy empty maps also accept []. Nonempty values must be objects."
    },
    "capabilities": {
      "type": "array",
      "maxItems": 80,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9._:+/-]*$",
        "maxLength": 96
      }
    },
    "commerce_roles": {
      "type": "array",
      "maxItems": 40,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9._:+/-]*$",
        "maxLength": 96
      }
    },
    "markets": {
      "type": "array",
      "maxItems": 40,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[A-Z0-9_-]+$",
        "maxLength": 16
      }
    },
    "payment_rails": {
      "type": "array",
      "maxItems": 40,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9._:+/-]*$",
        "maxLength": 96
      }
    },
    "public_key": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 4096,
      "description": "Optional public key material. v0.4 signed lifecycle authentication is available only for the exact format ed25519:<base64url-without-padding-of-32-byte-public-key>; other legacy strings remain accepted but are not usable for signed authentication."
    },
    "capability_declarations": {
      "type": "array",
      "maxItems": 40,
      "uniqueItems": false,
      "items": {
        "$ref": "https://rogueswarms.com/schema/capability-declaration.schema.json"
      }
    },
    "capability_pricing": {
      "type": "array",
      "items": {
        "$ref": "https://rogueswarms.com/schema/swarm.schema.json#/$defs/CapabilityPricing"
      },
      "maxItems": 80
    }
  }
}
