{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://trueasset.ai/verdict-spec-v1.json",
  "title": "Verdict Network Public Verdict Object — Draft",
  "description": "Proposed minimum public contract for a governed and verifiable asset verdict. Publication of this schema does not assert that the current TrueAsset implementation is conformant.",
  "x-signing-projection": {
    "projection_version": "verdict-preimage-v1",
    "hash_algorithm": "SHA-256",
    "canonicalization": "RFC8785-JCS",
    "remove_before_hashing": [
      "/signature",
      "/forward_returns",
      "/proof/verdict_hash",
      "/proof/replay_status",
      "/proof/anchor_status",
      "/proof/anchor_tx",
      "/proof/hash_status"
    ],
    "signed_payload": "raw-32-byte-sha256-digest"
  },
  "type": "object",
  "required": ["spec_status", "verdict_id", "asset", "issued_at", "knowledge_cutoff", "final_state", "actionability", "doctrine_version", "arbiter_version", "schema_version", "canonicalization", "evidence", "conflicts", "proof", "signature"],
  "properties": {
    "spec_status": { "const": "DRAFT_SHADOW" },
    "fixture": { "type": "boolean" },
    "fixture_notice": { "type": "string", "minLength": 1 },
    "verdict_id": { "type": "string", "minLength": 1 },
    "asset": {
      "type": "object",
      "required": ["canonical_id", "symbol"],
      "properties": {
        "canonical_id": { "type": "string" },
        "symbol": { "type": "string" },
        "chain": { "type": ["string", "null"] },
        "contract": { "type": ["string", "null"] }
      },
      "additionalProperties": false
    },
    "issued_at": { "type": "string", "format": "date-time" },
    "knowledge_cutoff": { "type": "string", "format": "date-time" },
    "final_state": { "type": "string" },
    "actionability": { "enum": ["TRADEABLE", "RESEARCH_ONLY", "WAIT", "BLOCKED", "ABSTAIN"] },
    "confidence": { "type": ["number", "null"], "minimum": 0, "maximum": 1 },
    "doctrine_version": { "type": "string" },
    "arbiter_version": { "type": "string" },
    "schema_version": { "type": "string" },
    "canonicalization": { "const": "RFC8785-JCS" },
    "evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["domain", "state", "source_role", "freshness_at_issuance", "lineage_hash"],
        "properties": {
          "domain": { "type": "string" },
          "state": { "type": "string" },
          "source_role": { "enum": ["LEAD", "CONFIRMING", "TIEBREAKER", "AUDIT", "FORWARD"] },
          "freshness_at_issuance": { "type": "string" },
          "lineage_hash": { "type": "string" }
        },
        "additionalProperties": false
      }
    },
    "conflicts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["status", "resolution"],
        "properties": { "status": { "type": "string" }, "resolution": { "type": "string" } },
        "additionalProperties": false
      }
    },
    "forward_returns": {
      "type": "object",
      "properties": {
        "15m": { "type": ["number", "null"] },
        "30m": { "type": ["number", "null"] },
        "1h": { "type": ["number", "null"] },
        "2h": { "type": ["number", "null"] },
        "4h": { "type": ["number", "null"] }
      },
      "additionalProperties": false
    },
    "proof": {
      "type": "object",
      "required": ["verdict_hash", "previous_verdict_hash", "replay_status", "anchor_status", "anchor_tx"],
      "properties": {
        "verdict_hash": { "type": "string", "pattern": "^0x[0-9a-fA-F]{64}$" },
        "previous_verdict_hash": { "type": "string", "pattern": "^0x[0-9a-fA-F]{64}$" },
        "replay_status": { "enum": ["PENDING", "BIT_EXACT", "FAILED"] },
        "anchor_status": { "enum": ["PENDING", "ANCHORED", "FAILED", "NOT_ANCHORED"] },
        "anchor_tx": { "type": ["string", "null"] },
        "hash_status": { "enum": ["COMPUTED", "FIXTURE_NOT_COMPUTED"] }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "if": { "type": "object", "properties": { "anchor_status": { "const": "ANCHORED" } }, "required": ["anchor_status"] },
          "then": { "type": "object", "properties": { "anchor_tx": { "type": "string", "minLength": 1 } }, "required": ["anchor_tx"] }
        }
      ]
    },
    "signature": {
      "type": "object",
      "required": ["algorithm", "encoding", "public_key_id", "signed_hash", "value", "verification_status"],
      "properties": {
        "algorithm": { "const": "Ed25519" },
        "encoding": { "const": "base64" },
        "public_key_id": { "type": "string", "minLength": 1 },
        "signed_hash": { "type": "string", "pattern": "^0x[0-9a-fA-F]{64}$" },
        "value": { "type": "string" },
        "verification_status": { "enum": ["VERIFIED", "FAILED", "NOT_VERIFIED"] }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "if": { "type": "object", "properties": { "verification_status": { "const": "VERIFIED" } }, "required": ["verification_status"] },
          "then": { "type": "object", "properties": { "value": { "type": "string", "pattern": "^[A-Za-z0-9+/]{86}==$" } }, "required": ["value"] }
        }
      ]
    }
  },
  "allOf": [
    {
      "if": { "type": "object", "properties": { "actionability": { "const": "TRADEABLE" } }, "required": ["actionability"] },
      "then": {
        "type": "object",
        "properties": {
          "proof": { "type": "object", "properties": { "replay_status": { "const": "BIT_EXACT" }, "hash_status": { "const": "COMPUTED" } }, "required": ["replay_status", "hash_status"] },
          "signature": { "type": "object", "properties": { "verification_status": { "const": "VERIFIED" } }, "required": ["verification_status"] }
        }
      }
    }
  ],
  "additionalProperties": false
}
