{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://taips.tap.rsvp/schemas/data-structures/agent.json",
  "title": "Agent",
  "description": "Represents software acting on behalf of a participant",
  "type": "object",
  "required": ["@id"],
  "properties": {
    "@id": {
      "$ref": "../common/base-types.json#/$defs/did",
      "description": "Decentralized Identifier of the agent"
    },
    "@type": {
      "oneOf": [
        {
          "const": "Agent"
        },
        {
          "type": "string",
          "format": "uri"
        }
      ],
      "description": "JSON-LD type identifier. Can be 'Agent' or a schema.org type like 'https://schema.org/Organization'"
    },
    "role": {
      "type": "string",
      "pattern": "^[A-Z][a-zA-Z]*$",
      "description": "Role of the agent in the transaction (PascalCase). Standard values include: SettlementAddress, SourceAddress, CustodialService, EscrowAgent"
    },
    "for": {
      "oneOf": [
        {
          "$ref": "../common/base-types.json#/$defs/did"
        },
        {
          "type": "array",
          "items": {
            "$ref": "../common/base-types.json#/$defs/did"
          },
          "minItems": 1
        }
      ],
      "description": "DID(s) of the party/parties this agent represents"
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the agent"
    },
    "nameHash": {
      "$ref": "../common/base-types.json#/$defs/base64",
      "description": "SHA-256 hash of the normalized agent name"
    },
    "lei:leiCode": {
      "$ref": "../common/base-types.json#/$defs/lei",
      "description": "Legal Entity Identifier code"
    },
    "policies": {
      "type": "array",
      "items": {
        "$ref": "policy.json"
      },
      "description": "Policies enforced by this agent"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "URL pointing to the agent's website (based on schema.org/Organization)"
    },
    "logo": {
      "type": "string",
      "format": "uri",
      "description": "URL pointing to the agent's logo image (based on schema.org/Organization)"
    },
    "description": {
      "type": "string",
      "description": "Description of the agent (based on schema.org/Organization)"
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "Contact email address (based on schema.org/Organization)"
    },
    "telephone": {
      "type": "string",
      "description": "Contact telephone number (based on schema.org/Organization)"
    }
  }
}