{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tenantpilot.local/contracts/reason-translation-entry.schema.json",
  "title": "Reason Translation Entry",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "artifactKey",
    "internalCode",
    "operatorLabel",
    "shortExplanation",
    "actionability",
    "diagnosticVisibility",
    "nextStepPolicy"
  ],
  "properties": {
    "artifactKey": {
      "type": "string"
    },
    "internalCode": {
      "type": "string"
    },
    "operatorLabel": {
      "type": "string",
      "minLength": 1
    },
    "shortExplanation": {
      "type": "string",
      "minLength": 1
    },
    "actionability": {
      "type": "string",
      "enum": [
        "retryable_transient",
        "permanent_configuration",
        "prerequisite_missing",
        "non_actionable"
      ]
    },
    "diagnosticVisibility": {
      "type": "string",
      "enum": [
        "always_available",
        "secondary_only"
      ]
    },
    "nextStepPolicy": {
      "type": "string",
      "enum": [
        "required",
        "optional",
        "none"
      ]
    },
    "taxonomyTerms": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "legacyInputs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "actionability": {
            "const": "prerequisite_missing"
          }
        },
        "required": [
          "actionability"
        ]
      },
      "then": {
        "properties": {
          "nextStepPolicy": {
            "enum": [
              "required",
              "optional"
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "actionability": {
            "const": "non_actionable"
          }
        },
        "required": [
          "actionability"
        ]
      },
      "then": {
        "properties": {
          "nextStepPolicy": {
            "const": "none"
          }
        }
      }
    }
  ]
}