{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xpower.agency/academy/agents/schema.json",
  "title": "X Power educational effect dossier v1.0.0",
  "description": "Data completeness schema only. Validation is not legal, physical or payment authorisation.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "example_kind",
    "record_id",
    "asset",
    "measurement",
    "right",
    "allocation",
    "control",
    "settlement",
    "assessment"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0.0"
    },
    "example_kind": {
      "enum": [
        "synthetic",
        "anonymized"
      ]
    },
    "record_id": {
      "type": "string",
      "minLength": 1
    },
    "asset": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "object_id",
        "reflection_version",
        "boundary",
        "state",
        "as_of"
      ],
      "properties": {
        "object_id": {
          "type": "string",
          "minLength": 1
        },
        "reflection_version": {
          "type": "string",
          "minLength": 1
        },
        "boundary": {
          "type": "string",
          "minLength": 1
        },
        "state": {
          "type": "string",
          "minLength": 1
        },
        "as_of": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "measurement": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "period_start",
        "period_end",
        "unit",
        "baseline_version",
        "baseline_adjusted",
        "actual",
        "delta",
        "uncertainty",
        "oracle_statement_ref",
        "evidence_refs"
      ],
      "properties": {
        "period_start": {
          "type": "string",
          "minLength": 1
        },
        "period_end": {
          "type": "string",
          "minLength": 1
        },
        "unit": {
          "type": "string",
          "minLength": 1
        },
        "baseline_version": {
          "type": "string",
          "minLength": 1
        },
        "baseline_adjusted": {
          "type": [
            "number",
            "null"
          ]
        },
        "actual": {
          "type": [
            "number",
            "null"
          ]
        },
        "delta": {
          "type": [
            "number",
            "null"
          ]
        },
        "uncertainty": {
          "type": [
            "number",
            "null"
          ]
        },
        "oracle_statement_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidence_refs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "right": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "right_id",
        "type",
        "holder_ref",
        "payment_party_ref",
        "legal_basis_ref",
        "jurisdiction",
        "status",
        "encumbrance_refs"
      ],
      "properties": {
        "right_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": [
            "string",
            "null"
          ]
        },
        "holder_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "payment_party_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "legal_basis_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "jurisdiction": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "enum": [
            "draft",
            "validated",
            "active",
            "suspended",
            "expired",
            "discharged",
            "disputed"
          ]
        },
        "encumbrance_refs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "allocation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "lineage_root",
        "atom_id",
        "quantity",
        "unit",
        "allocated_quantity",
        "overlap_check",
        "compatibility_evidence_refs"
      ],
      "properties": {
        "lineage_root": {
          "type": "string",
          "minLength": 1
        },
        "atom_id": {
          "type": "string",
          "minLength": 1
        },
        "unit": {
          "type": "string",
          "minLength": 1
        },
        "quantity": {
          "type": "number",
          "minimum": 0
        },
        "allocated_quantity": {
          "type": "number",
          "minimum": 0
        },
        "overlap_check": {
          "enum": [
            "unverified",
            "clear",
            "conflict"
          ]
        },
        "compatibility_evidence_refs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "control": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "authority_ref",
        "valid_until",
        "allowed_actions",
        "constraints",
        "stop_mechanism_ref"
      ],
      "properties": {
        "authority_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "valid_until": {
          "type": [
            "string",
            "null"
          ]
        },
        "stop_mechanism_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "allowed_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "constraints": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "settlement": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "currency",
        "amount",
        "due_at",
        "reservation_ref",
        "payment_ref"
      ],
      "properties": {
        "state": {
          "enum": [
            "projected",
            "reserved",
            "payable",
            "settled",
            "failed",
            "disputed"
          ]
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "amount": {
          "type": [
            "number",
            "null"
          ]
        },
        "due_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "reservation_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "payment_ref": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "assessment": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "task_id",
        "object_ref",
        "as_of",
        "evidence_status",
        "decision",
        "reason_codes",
        "missing_evidence",
        "next_authorized_action",
        "source_refs"
      ],
      "properties": {
        "task_id": {
          "type": "string",
          "minLength": 1
        },
        "object_ref": {
          "type": "string",
          "minLength": 1
        },
        "as_of": {
          "type": "string",
          "minLength": 1
        },
        "next_authorized_action": {
          "type": "string",
          "minLength": 1
        },
        "evidence_status": {
          "enum": [
            "unverified",
            "modelled",
            "partly_verified",
            "verified",
            "disputed"
          ]
        },
        "decision": {
          "enum": [
            "HOLD",
            "REJECT",
            "ESCALATE",
            "MODEL_ONLY",
            "REVIEW_READY"
          ]
        },
        "reason_codes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "missing_evidence": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "source_refs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  },
  "x_semantic_checks": [
    "period_start precedes period_end",
    "units and boundary are consistent",
    "allocated_quantity must not exceed eligible quantity",
    "overlap checks span all registries and derivative rights",
    "signed evidence is not physical verification",
    "active control authority and safety limits are required before physical action",
    "SETTLED requires confirmed payment_ref",
    "dates and legal status must be independently verified"
  ]
}
