{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.ergoblockchain.org/agent-economy/mainnet-script-identity.schema.v0.json",
  "title": "Ergo Agent Economy Mainnet Script Identity Manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "type",
    "version",
    "status",
    "network",
    "provider_id",
    "review_boundary",
    "scripts",
    "publication_requirements"
  ],
  "properties": {
    "type": {
      "const": "ergo.agent_economy.mainnet_script_identity_manifest.v0"
    },
    "version": {
      "const": "v0"
    },
    "status": {
      "const": "completed_audit_bound_mainnet_identity"
    },
    "network": {
      "const": "mainnet"
    },
    "provider_id": {
      "const": "provider://sage-ergoblockchain"
    },
    "review_boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "reviewed_site_commit",
        "reviewed_lockfile_hash",
        "reviewed_package_versions",
        "compiler_or_serialization_toolchain",
        "reviewer_or_auditor",
        "external_review_manifest"
      ],
      "properties": {
        "reviewed_site_commit": { "type": "string", "minLength": 7 },
        "reviewed_lockfile_hash": { "type": "string", "minLength": 16 },
        "reviewed_package_versions": {
          "type": "object",
          "minProperties": 1,
          "additionalProperties": {
            "type": "string",
            "minLength": 1
          }
        },
        "compiler_or_serialization_toolchain": { "type": "string", "minLength": 1 },
        "reviewer_or_auditor": { "type": "string", "minLength": 1 },
        "external_review_manifest": { "type": "string", "format": "uri" }
      }
    },
    "scripts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "role",
          "source_artifact",
          "source_artifact_hash",
          "compiled_ergo_tree",
          "compiled_ergo_tree_hash",
          "mainnet_address",
          "test_vectors"
        ],
        "properties": {
          "id": { "type": "string", "minLength": 1 },
          "role": { "type": "string", "minLength": 1 },
          "source_artifact": { "type": "string", "minLength": 1 },
          "source_artifact_hash": { "type": "string", "minLength": 16 },
          "compiled_ergo_tree": { "type": "string", "minLength": 16 },
          "compiled_ergo_tree_hash": { "type": "string", "minLength": 16 },
          "mainnet_address": { "type": "string", "minLength": 16 },
          "register_contract": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "minLength": 1
            }
          },
          "test_vectors": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id",
                "expected_result",
                "inputs"
              ],
              "properties": {
                "id": { "type": "string", "minLength": 1 },
                "expected_result": {
                  "enum": [
                    "accept",
                    "reject"
                  ]
                },
                "inputs": {
                  "type": "array",
                  "minItems": 1,
                  "items": { "type": "string", "minLength": 1 }
                },
                "notes": { "type": "string" }
              }
            }
          }
        }
      }
    },
    "publication_requirements": {
      "type": "array",
      "minItems": 1,
      "items": { "type": "string", "minLength": 1 }
    }
  }
}
