{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tenantpilot.local/contracts/request-scoped-derived-state-key.schema.json",
  "title": "RequestScopedDerivedStateKey",
  "description": "Deterministic key used to identify one reusable derived-state result inside a single request. This schema describes the internal runtime key shape using snake_case field names; the logical OpenAPI contract documents an equivalent camelCase transport form that must normalize back to this structure.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "family",
    "record_class",
    "record_key",
    "variant"
  ],
  "properties": {
    "family": {
      "type": "string",
      "enum": [
        "artifact_truth",
        "operation_ux_guidance",
        "operation_ux_explanation",
        "related_navigation_primary",
        "related_navigation_detail",
        "related_navigation_header"
      ]
    },
    "record_class": {
      "type": "string",
      "minLength": 1,
      "examples": [
        "App\\Models\\TenantReview"
      ]
    },
    "record_key": {
      "type": "string",
      "minLength": 1,
      "examples": [
        "42"
      ]
    },
    "variant": {
      "type": "string",
      "minLength": 1,
      "examples": [
        "list_row",
        "detail_page",
        "header_action"
      ]
    },
    "workspace_id": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "tenant_id": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "context_hash": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "description": "Stable hash of additional scope-sensitive or capability-sensitive inputs required to distinguish the result."
    }
  }
}