{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://apeiris.ai/integration/schemas/v1/evidence.schema.json",
  "title": "Apeiris Cross-Domain Evidence Artifact",
  "description": "A portable, cryptographically integrity-protected evidence record that can be produced by one Apeiris domain verifier and relied upon ('consumed') by another domain, an auditor, or a regulator. The evidence_id is stable and content-addressed. The integrity block (hash + optional signature) allows any consumer to verify the artefact has not been altered since collection. The producer/consumer split supports cross-domain evidence reuse — a model assurance verifier can produce an evaluation scorecard that a compliance verifier consumes without re-running the evaluation.",
  "type": "object",
  "required": [
    "evidence_id",
    "subject",
    "producer_verifier",
    "control_refs",
    "evidence_type",
    "scope",
    "collected_at",
    "collection_method",
    "integrity",
    "result",
    "confidence"
  ],
  "additionalProperties": false,
  "properties": {
    "evidence_id": {
      "type": "string",
      "description": "Globally unique, stable identifier for this evidence record. Convention: evi:<domain>:<control-layer>-<seq>:<YYYY-MM-DD>-<8-char-random>. Examples: evi:model:LI-01:2026-03-15-a7f32c9b, evi:security:IA-02:2026-01-10-d3e8f012. The domain and control-layer segments enable routing and indexing without opening the record.",
      "pattern": "^evi:[a-z][a-z0-9-]*:[A-Z]{2,6}-[0-9]{2}:[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-f0-9]{8}$"
    },
    "schema_version": {
      "type": "string",
      "description": "Optional: version of the evidence schema this record conforms to. Defaults to v1 if absent. Used by consumers to select the correct parser.",
      "enum": [
        "v1"
      ],
      "default": "v1"
    },
    "subject": {
      "type": "object",
      "required": [
        "type",
        "id"
      ],
      "additionalProperties": false,
      "description": "The governed entity this evidence pertains to. The subject is the thing being assessed — not the control being assessed against, and not the team doing the assessing.",
      "properties": {
        "type": {
          "type": "string",
          "description": "Ontological category of the subject. ai-system = a complete AI application deployment. model = a specific trained model checkpoint. dataset = a training, evaluation, or grounding dataset. pipeline = a data or training pipeline. organization = an enterprise or team. deployment = a specific runtime instantiation of an AI system. control = an Apeiris control implementation (meta-evidence about a control itself).",
          "enum": [
            "ai-system",
            "model",
            "dataset",
            "pipeline",
            "organization",
            "deployment",
            "control"
          ]
        },
        "id": {
          "type": "string",
          "description": "Stable identifier of the subject within its type's registry. For ai-system or deployment: the assurance-target id. For model: the model registry id. For dataset: the data lineage id. For organization: tenant id or organisation URN.",
          "minLength": 1,
          "maxLength": 512
        },
        "display_name": {
          "type": "string",
          "description": "Optional human-readable name of the subject for rendering in audit reports. Never use this field for programmatic routing — use id.",
          "maxLength": 256
        },
        "version": {
          "type": "string",
          "description": "Optional: version or snapshot identifier of the subject at the time of evidence collection. For models: checkpoint tag. For datasets: version string or commit hash.",
          "maxLength": 128
        }
      }
    },
    "producer_verifier": {
      "type": "string",
      "description": "The Apeiris domain verifier or external entity that produced this evidence record. For Apeiris-native producers, use the decentralized URI form: apeiris://model, apeiris://security, apeiris://privacy. For external producers: third-party-auditor, vendor-self-attestation, regulatory-submission, red-team-operator. The producer is responsible for the integrity of the record.",
      "minLength": 3,
      "maxLength": 256
    },
    "consumer_verifiers": {
      "type": "array",
      "description": "Domains, verifiers, or entities that are authorized to rely on this evidence record without re-collecting it. Use Apeiris URIs for Apeiris domains (apeiris://compliance, apeiris://finance) or role labels for external consumers (internal-audit, regulator-occ, external-auditor-big4). An empty array means the evidence is for internal use of the producer only.",
      "items": {
        "type": "string",
        "minLength": 3,
        "maxLength": 256
      },
      "uniqueItems": true
    },
    "control_refs": {
      "type": "array",
      "description": "Apeiris control URIs that this evidence was collected to assess. Use the decentralized URI form: apeiris://model/controls/LI-01, apeiris://security/controls/IA-02. Multiple controls may share evidence (e.g. a third-party audit report may cover an entire layer).",
      "items": {
        "type": "string",
        "description": "Apeiris control URI.",
        "pattern": "^apeiris://[a-z][a-z0-9-]*/controls/[A-Z]{2,6}-[0-9]{2}$"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "evidence_type": {
      "type": "string",
      "description": "Category of evidence artefact. automated-test-result = output of an automated test suite or CI pipeline. audit-log = system-generated immutable log extract. third-party-audit-report = formal report from an external auditor. red-team-report = adversarial testing report. configuration-snapshot = point-in-time configuration dump. policy-attestation = signed attestation that a policy is in force. evaluation-scorecard = structured model evaluation results (benchmark, safety eval, capability assessment). monitoring-alert-history = aggregate of monitoring signals over a window. incident-record = documented incident and its resolution. model-card = published model card or system card. data-lineage-record = data provenance and lineage documentation. human-review-record = log of human-in-the-loop review decisions. certification = third-party certification or conformity assessment. apeiris-assertion = Apeiris-generated structured assertion from the runtime verifier.",
      "enum": [
        "automated-test-result",
        "audit-log",
        "third-party-audit-report",
        "red-team-report",
        "configuration-snapshot",
        "policy-attestation",
        "evaluation-scorecard",
        "monitoring-alert-history",
        "incident-record",
        "model-card",
        "data-lineage-record",
        "human-review-record",
        "certification",
        "apeiris-assertion"
      ]
    },
    "scope": {
      "type": "string",
      "description": "Narrative description of what system, time period, population, or configuration this evidence covers. Be specific: 'GPT-4o fine-tune deployed in EMEA customer service tier, inference logs 2026-01-01 through 2026-03-31, 2.4M requests sampled at 1%' is acceptable. 'Production system' is not.",
      "minLength": 10,
      "maxLength": 2048
    },
    "collected_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 datetime (with timezone) when this evidence was collected, generated, or finalised. For automated evidence: pipeline completion time. For audit reports: report issuance date-time."
    },
    "valid_until": {
      "type": "string",
      "format": "date-time",
      "description": "Optional: ISO 8601 datetime after which this evidence is considered stale and must be re-collected for continued assurance reliance. The model assurance domain recommends a maximum validity of 90 days for automated test results and 365 days for third-party audits. Absence of this field does not imply perpetual validity — consumers should apply domain-level staleness policies."
    },
    "collection_method": {
      "type": "string",
      "description": "Description of how the evidence was collected. Be specific about automation vs. human involvement: automated-pipeline (CI/CD test suite), api-export (programmatic log or config export), manual-inspection (human reviewer walked through the system), structured-interview (reviewer interviewed the team), external-audit (independent auditor engaged under formal SOW), red-team-exercise (structured adversarial testing campaign).",
      "minLength": 5,
      "maxLength": 512
    },
    "integrity": {
      "type": "object",
      "required": [
        "hash"
      ],
      "additionalProperties": false,
      "description": "Cryptographic integrity controls for the evidence artefact. The hash field is mandatory and pins the exact content. The signature field enables non-repudiation — it allows a consumer to verify that the named producer_verifier signed the record.",
      "properties": {
        "hash": {
          "type": "string",
          "description": "SHA-256 hex digest of the canonical serialisation of the evidence artefact (the raw file or structured JSON prior to this integrity block). Format: sha256:<64 hex chars>. Computed before signing.",
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "signature": {
          "type": "string",
          "description": "Optional: Base64-encoded detached cryptographic signature over the hash, produced by the producer_verifier's signing key. Signature scheme and key identifier are communicated out-of-band via the Apeiris trust registry.",
          "minLength": 16
        },
        "signing_key_id": {
          "type": "string",
          "description": "Optional: identifier of the signing key used to produce the signature. References the Apeiris trust registry key record. Required when signature is present.",
          "maxLength": 256
        }
      }
    },
    "result": {
      "type": "string",
      "description": "Outcome of the evidence collection against the referenced controls. pass = control is assessed as implemented and effective. fail = control is not implemented or is ineffective. partial = control is partially implemented; coverage gap documented in scope. not-tested = evidence was not collected for this control in this cycle. not-applicable = the control does not apply to this subject (document rationale in scope). exception-granted = a formal risk acceptance or compensating control exception has been approved and is on file.",
      "enum": [
        "pass",
        "fail",
        "partial",
        "not-tested",
        "not-applicable",
        "exception-granted"
      ]
    },
    "confidence": {
      "type": "string",
      "description": "Assessor confidence in the result. high = evidence is complete, methodology is sound, reviewer is expert, and the result is unambiguous. medium = evidence is materially complete but there are methodological caveats, partial data gaps, or the reviewer has adjacent rather than direct expertise. low = evidence is limited, the methodology is preliminary, or the result is contested.",
      "enum": [
        "high",
        "medium",
        "low"
      ]
    },
    "findings": {
      "type": "array",
      "description": "Optional: structured list of individual findings when result is fail, partial, or exception-granted. Each finding describes a specific gap or deficiency.",
      "items": {
        "type": "object",
        "required": [
          "finding_id",
          "severity",
          "description"
        ],
        "additionalProperties": false,
        "properties": {
          "finding_id": {
            "type": "string",
            "description": "Finding identifier, scoped to this evidence record. Convention: F-<seq>, e.g. F-01, F-02.",
            "pattern": "^F-[0-9]{2,4}$"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low",
              "informational"
            ],
            "description": "Severity of the finding."
          },
          "description": {
            "type": "string",
            "description": "Precise description of the gap, deficiency, or observation.",
            "minLength": 10,
            "maxLength": 2048
          },
          "remediation": {
            "type": "string",
            "description": "Optional: recommended remediation action and target date.",
            "maxLength": 1024
          }
        }
      }
    }
  }
}
