{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://postbridge.ai/schemas/agent-v1.json",
  "title": "PostBridge Agent Metadata",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "name",
    "description",
    "version",
    "did",
    "capabilities",
    "protocols",
    "authentication"
  ],
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "version": {
      "type": "string"
    },
    "did": {
      "type": "string",
      "pattern": "^did:"
    },
    "logo": {
      "type": "string",
      "format": "uri"
    },
    "contact": {
      "type": "string"
    },
    "capabilities": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "description"],
        "additionalProperties": true,
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "endpoint": {
            "type": "string"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "protocols": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "authentication": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "preferred": {
          "type": "string"
        },
        "methods": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["type", "description"],
            "additionalProperties": true,
            "properties": {
              "type": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "header": {
                "type": "string"
              },
              "signup_required": {
                "type": "boolean"
              }
            }
          }
        }
      }
    }
  }
}
