{
  "description": "Schema for AURA (Agent-Usable Resource Assertion) manifest files",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "title": "$schema"
    },
    "id": {
      "type": "string",
      "title": "id"
    },
    "protocol": {
      "type": "string",
      "const": "AURA",
      "title": "protocol"
    },
    "version": {
      "type": "string",
      "const": "1.0",
      "title": "version"
    },
    "site": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "title": "name"
        },
        "description": {
          "type": "string",
          "title": "description"
        },
        "url": {
          "type": "string",
          "title": "url"
        }
      },
      "required": [
        "name",
        "url"
      ],
      "title": "site"
    },
    "resources": {
      "$ref": "#/definitions/Record<string,Resource>",
      "title": "resources"
    },
    "capabilities": {
      "$ref": "#/definitions/Record<string,Capability>",
      "title": "capabilities"
    },
    "policy": {
      "description": "Policy - Site-wide policies for rate limiting and authentication\nProvides hints to agents about how to interact with the site",
      "$ref": "#/definitions/Policy",
      "title": "policy"
    }
  },
  "required": [
    "$schema",
    "capabilities",
    "protocol",
    "resources",
    "site",
    "version"
  ],
  "definitions": {
    "Record<string,Resource>": {
      "title": "Record<string,Resource>",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/Resource"
      }
    },
    "Record<string,Capability>": {
      "title": "Record<string,Capability>",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/Capability"
      }
    },
    "Policy": {
      "description": "Policy - Site-wide policies for rate limiting and authentication\nProvides hints to agents about how to interact with the site",
      "title": "Policy",
      "type": "object",
      "properties": {
        "rateLimit": {
          "type": "object",
          "properties": {
            "limit": {
              "type": "number",
              "title": "limit"
            },
            "window": {
              "enum": [
                "day",
                "hour",
                "minute",
                "second"
              ],
              "type": "string",
              "title": "window"
            }
          },
          "required": [
            "limit",
            "window"
          ],
          "title": "rateLimit"
        },
        "authHint": {
          "enum": [
            "bearer",
            "cookie",
            "none"
          ],
          "type": "string",
          "title": "authHint"
        }
      }
    },
    "Resource": {
      "description": "Resource - Defines where actions can be performed\nSeparated from capabilities for improved clarity",
      "type": "object",
      "properties": {
        "uriPattern": {
          "type": "string",
          "title": "uriPattern"
        },
        "description": {
          "type": "string",
          "title": "description"
        },
        "operations": {
          "type": "object",
          "properties": {
            "GET": {
              "type": "object",
              "properties": {
                "capabilityId": {
                  "type": "string",
                  "title": "capabilityId"
                }
              },
              "required": [
                "capabilityId"
              ],
              "title": "GET"
            },
            "POST": {
              "type": "object",
              "properties": {
                "capabilityId": {
                  "type": "string",
                  "title": "capabilityId"
                }
              },
              "required": [
                "capabilityId"
              ],
              "title": "POST"
            },
            "PUT": {
              "type": "object",
              "properties": {
                "capabilityId": {
                  "type": "string",
                  "title": "capabilityId"
                }
              },
              "required": [
                "capabilityId"
              ],
              "title": "PUT"
            },
            "DELETE": {
              "type": "object",
              "properties": {
                "capabilityId": {
                  "type": "string",
                  "title": "capabilityId"
                }
              },
              "required": [
                "capabilityId"
              ],
              "title": "DELETE"
            }
          },
          "title": "operations"
        }
      },
      "required": [
        "description",
        "operations",
        "uriPattern"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "Capability": {
      "description": "Capability - Self-executing contract with concrete action\nNow includes versioning and HttpAction definition",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "title": "id"
        },
        "v": {
          "type": "number",
          "title": "v"
        },
        "description": {
          "type": "string",
          "title": "description"
        },
        "parameters": {
          "description": "JSONSchema - A simplified JSON Schema definition\nRepresents the structure for capability parameters",
          "$ref": "#/definitions/JSONSchema",
          "title": "parameters"
        },
        "action": {
          "$ref": "#/definitions/HttpAction",
          "title": "action"
        }
      },
      "required": [
        "action",
        "description",
        "id",
        "v"
      ],
      "$schema": "http://json-schema.org/draft-07/schema#"
    },
    "JSONSchema": {
      "description": "JSONSchema - A simplified JSON Schema definition\nRepresents the structure for capability parameters",
      "title": "JSONSchema",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "title": "type"
        },
        "properties": {
          "$ref": "#/definitions/Record<string,JSONSchema>",
          "title": "properties"
        },
        "required": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "title": "required"
        },
        "items": {
          "description": "JSONSchema - A simplified JSON Schema definition\nRepresents the structure for capability parameters",
          "$ref": "#/definitions/JSONSchema",
          "title": "items"
        },
        "format": {
          "type": "string",
          "title": "format"
        },
        "minimum": {
          "type": "number",
          "title": "minimum"
        },
        "maximum": {
          "type": "number",
          "title": "maximum"
        },
        "minLength": {
          "type": "number",
          "title": "minLength"
        },
        "maxLength": {
          "type": "number",
          "title": "maxLength"
        },
        "pattern": {
          "type": "string",
          "title": "pattern"
        },
        "enum": {
          "type": "array",
          "items": {},
          "title": "enum"
        },
        "default": {
          "title": "default"
        },
        "description": {
          "type": "string",
          "title": "description"
        },
        "title": {
          "type": "string",
          "title": "title"
        },
        "additionalProperties": {
          "anyOf": [
            {
              "$ref": "#/definitions/JSONSchema"
            },
            {
              "type": "boolean"
            }
          ],
          "title": "additionalProperties"
        }
      }
    },
    "Record<string,JSONSchema>": {
      "title": "Record<string,JSONSchema>",
      "type": "object"
    },
    "HttpAction": {
      "description": "HttpAction - Defines how to execute a capability via HTTP\nIncludes security, encoding, and parameter mapping",
      "title": "HttpAction",
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "HTTP",
          "title": "type"
        },
        "method": {
          "enum": [
            "DELETE",
            "GET",
            "POST",
            "PUT"
          ],
          "type": "string",
          "title": "method"
        },
        "urlTemplate": {
          "type": "string",
          "title": "urlTemplate"
        },
        "cors": {
          "type": "boolean",
          "title": "cors"
        },
        "encoding": {
          "enum": [
            "json",
            "query"
          ],
          "type": "string",
          "title": "encoding"
        },
        "parameterMapping": {
          "$ref": "#/definitions/Record<string,string>",
          "title": "parameterMapping"
        }
      },
      "required": [
        "method",
        "parameterMapping",
        "type",
        "urlTemplate"
      ]
    },
    "Record<string,string>": {
      "title": "Record<string,string>",
      "type": "object"
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://aura.dev/schemas/v1.0.json",
  "title": "AURA Manifest v1.0",
  "$defs": {
    "Email": {
      "type": "string",
      "format": "email",
      "description": "Email address format"
    },
    "ISODate": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 date-time format"
    },
    "URI": {
      "type": "string",
      "format": "uri",
      "description": "URI format"
    }
  }
}