{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://byteplane.dev/schemas/abi-method-manifest.schema.json",
  "title": "Byteplane ABI Method Manifest",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "origin", "methods"],
  "properties": {
    "version": { "const": "1.0" },
    "origin": { "const": "local" },
    "methods": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name", "signature", "selector", "access", "stateMutability", "inputs", "outputs"],
        "properties": {
          "name": { "type": "string", "minLength": 1 },
          "signature": { "type": "string", "minLength": 3 },
          "selector": { "type": ["string", "null"], "pattern": "^0x[0-9a-f]{8}$" },
          "access": { "enum": ["read", "write"] },
          "stateMutability": { "enum": ["pure", "view", "nonpayable", "payable"] },
          "inputs": { "$ref": "#/$defs/parameters" },
          "outputs": { "$ref": "#/$defs/parameters" }
        }
      }
    }
  },
  "$defs": {
    "parameters": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name", "type", "internalType"],
        "properties": {
          "name": { "type": "string" },
          "type": { "type": "string", "minLength": 1 },
          "internalType": { "type": ["string", "null"] }
        }
      }
    }
  }
}
