{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tenantpilot.local/contracts/operator-taxonomy-entry.schema.json",
  "title": "Operator Taxonomy Entry",
  "description": "Documentation-first schema for one taxonomy-backed operator state mapping. The severity enum matches the runtime Filament badge color band.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "domain",
    "raw_value",
    "axis",
    "primary_label",
    "severity",
    "classification_level",
    "next_action_policy",
    "legacy_aliases",
    "notes"
  ],
  "properties": {
    "domain": {
      "type": "string",
      "minLength": 1,
      "examples": [
        "restore_result_status"
      ]
    },
    "raw_value": {
      "type": "string",
      "minLength": 1,
      "examples": [
        "manual_required"
      ]
    },
    "axis": {
      "type": "string",
      "enum": [
        "execution_lifecycle",
        "execution_outcome",
        "item_result",
        "data_coverage",
        "evidence_depth",
        "product_support_maturity",
        "data_freshness",
        "operator_actionability",
        "publication_readiness",
        "governance_deviation"
      ],
      "examples": [
        "operator_actionability"
      ]
    },
    "primary_label": {
      "type": "string",
      "minLength": 1,
      "examples": [
        "Manual follow-up needed"
      ]
    },
    "severity": {
      "type": "string",
      "description": "Operator-facing severity band, mapped to the Filament badge color used at runtime.",
      "enum": [
        "gray",
        "info",
        "success",
        "warning",
        "danger",
        "primary"
      ],
      "examples": [
        "warning"
      ]
    },
    "classification_level": {
      "type": "string",
      "enum": [
        "primary",
        "diagnostic"
      ],
      "examples": [
        "primary"
      ]
    },
    "next_action_policy": {
      "type": "string",
      "enum": [
        "required",
        "optional",
        "none"
      ],
      "examples": [
        "required"
      ]
    },
    "legacy_aliases": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "examples": [
        [
          "Manual required"
        ]
      ]
    },
    "diagnostic_label": {
      "type": [
        "string",
        "null"
      ],
      "examples": [
        null
      ]
    },
    "notes": {
      "type": "string",
      "minLength": 1,
      "examples": [
        "The operator must handle this item manually."
      ]
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "classification_level": {
            "const": "diagnostic"
          }
        }
      },
      "then": {
        "properties": {
          "severity": {
            "enum": [
              "gray",
              "info",
              "primary"
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "severity": {
            "enum": [
              "warning",
              "danger"
            ]
          },
          "classification_level": {
            "const": "primary"
          }
        }
      },
      "then": {
        "properties": {
          "next_action_policy": {
            "enum": [
              "required",
              "optional"
            ]
          }
        }
      }
    }
  ],
  "examples": [
    {
      "domain": "restore_result_status",
      "raw_value": "manual_required",
      "axis": "operator_actionability",
      "primary_label": "Manual follow-up needed",
      "severity": "warning",
      "classification_level": "primary",
      "next_action_policy": "required",
      "legacy_aliases": [
        "Manual required"
      ],
      "diagnostic_label": null,
      "notes": "The operator must handle this item manually."
    }
  ]
}
