{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.logicsrc.com/logicsrc-agent.schema.json",
  "title": "LogicSRC Agent",
  "type": "object",
  "required": ["type", "version", "name", "did", "owner_did", "skills", "permissions_requested"],
  "additionalProperties": false,
  "properties": {
    "type": { "const": "logicsrc.agent" },
    "version": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
    "name": { "type": "string", "minLength": 1, "maxLength": 120 },
    "did": { "$ref": "#/$defs/did" },
    "owner_did": { "$ref": "#/$defs/did" },
    "description": { "type": "string" },
    "skills": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string", "minLength": 1 },
      "uniqueItems": true
    },
    "supported_task_types": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 },
      "uniqueItems": true
    },
    "pricing": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "model": { "type": "string", "enum": ["free", "per_task", "hourly", "subscription"] },
        "amount": { "type": "number", "minimum": 0 },
        "currency": { "type": "string", "minLength": 2, "maxLength": 12 }
      }
    },
    "permissions_requested": {
      "type": "array",
      "items": { "type": "string", "pattern": "^[a-z][a-z0-9._-]*(:[a-z][a-z0-9._-]*)?$" },
      "uniqueItems": true
    },
    "webhook_url": { "type": "string", "format": "uri" },
    "polling_mode": { "type": "boolean" },
    "public": { "type": "boolean", "default": true },
    "logicsrc_compatibility_version": { "type": "string" }
  },
  "$defs": {
    "did": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]*\\.[a-z0-9][a-z0-9._-]*$"
    }
  }
}
