{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gridzen-ai/json-schema/gridzen-ai-decision-trace-schema.json",
  "title": "DecisionTrace",
  "description": "PII-minimized operational audit entry, suitable for a future audit store.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gridzen-ai-openapi.json#/components/schemas/DecisionTrace",
  "properties": {
    "trace_id": {
      "type": "string",
      "title": "Trace Id"
    },
    "event": {
      "$ref": "#/$defs/DecisionEvent"
    },
    "decision": {
      "$ref": "#/$defs/DecisionOutcome"
    },
    "risk_score": {
      "type": "integer",
      "title": "Risk Score"
    },
    "reason_codes": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Reason Codes"
    },
    "providers_used": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Providers Used"
    },
    "identifier_types": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Identifier Types"
    },
    "consent_reference_present": {
      "type": "boolean",
      "title": "Consent Reference Present"
    },
    "evaluated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Evaluated At"
    }
  },
  "type": "object",
  "required": [
    "trace_id",
    "event",
    "decision",
    "risk_score",
    "reason_codes",
    "providers_used",
    "identifier_types",
    "consent_reference_present",
    "evaluated_at"
  ],
  "$defs": {
    "DecisionEvent": {
      "type": "string",
      "enum": [
        "onboarding",
        "payout",
        "account_change"
      ],
      "title": "DecisionEvent"
    },
    "DecisionOutcome": {
      "type": "string",
      "enum": [
        "allow",
        "review",
        "decline"
      ],
      "title": "DecisionOutcome"
    }
  }
}