{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.driftframe.org/site-reading-governance/v2.0/claim-veracity.schema.json",
  "title": "Claim Veracity Record",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "claim_id",
    "claim_type",
    "statement",
    "status",
    "scope_band",
    "provenance",
    "verification",
    "evidence_artifacts",
    "limitations",
    "as_of",
    "recheck_triggers",
    "settlement_status",
    "metadata"
  ],
  "properties": {
    "claim_id": {
      "$ref": "common.schema.json#/$defs/identifier"
    },
    "claim_type": {
      "type": "string",
      "enum": [
        "portable_architecture",
        "version_specific",
        "service_current",
        "local_measurement",
        "projected_outcome"
      ]
    },
    "statement": {
      "type": "string",
      "minLength": 20,
      "maxLength": 1200
    },
    "status": {
      "type": "string",
      "enum": [
        "verified",
        "source_supported",
        "source_specific",
        "draft_probe",
        "local_measurement_needed",
        "correction_needed",
        "hold_for_resilience_pass"
      ]
    },
    "scope_band": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "technology",
        "versions",
        "environment",
        "applies_from",
        "review_by"
      ],
      "properties": {
        "technology": {
          "type": "string",
          "minLength": 2,
          "maxLength": 160
        },
        "versions": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          }
        },
        "environment": {
          "type": "string",
          "minLength": 2,
          "maxLength": 160
        },
        "applies_from": {
          "type": "string",
          "format": "date"
        },
        "review_by": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "provenance": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source_label",
          "source_kind",
          "locator",
          "retrieved_on"
        ],
        "properties": {
          "source_label": {
            "type": "string",
            "minLength": 3,
            "maxLength": 240
          },
          "source_kind": {
            "type": "string",
            "enum": [
              "official_documentation",
              "standard",
              "research",
              "repository",
              "local_execution",
              "simulation"
            ]
          },
          "locator": {
            "$ref": "common.schema.json#/$defs/governedLocator"
          },
          "retrieved_on": {
            "type": "string",
            "format": "date"
          }
        }
      }
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "expected_observation",
        "checks"
      ],
      "properties": {
        "method": {
          "type": "string",
          "minLength": 10,
          "maxLength": 700
        },
        "expected_observation": {
          "type": "string",
          "minLength": 10,
          "maxLength": 700
        },
        "checks": {
          "type": "array",
          "items": {
            "$ref": "common.schema.json#/$defs/executableCheck"
          }
        }
      }
    },
    "evidence_artifacts": {
      "type": "array",
      "items": {
        "$ref": "common.schema.json#/$defs/artifact"
      }
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 5,
        "maxLength": 700
      }
    },
    "as_of": {
      "type": "string",
      "format": "date-time"
    },
    "recheck_triggers": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 5,
        "maxLength": 500
      }
    },
    "settlement_status": {
      "type": "string",
      "enum": [
        "candidate",
        "review_ready",
        "settled",
        "superseded"
      ]
    },
    "metadata": {
      "$ref": "common.schema.json#/$defs/recordMetadata"
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "status": {
            "const": "verified"
          }
        },
        "required": [
          "status"
        ]
      },
      "then": {
        "properties": {
          "evidence_artifacts": {
            "minItems": 1
          },
          "verification": {
            "properties": {
              "checks": {
                "minItems": 1
              }
            }
          }
        }
      }
    }
  ]
}
