{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ekas.io/rules/10dlc/schema.json",
  "title": "Ekas 10DLC rule",
  "description": "One A2P 10DLC obligation: a requirement that can independently cause a brand or campaign registration to be rejected.",
  "type": "object",
  "required": [
    "id",
    "title",
    "statement",
    "rationale",
    "layer",
    "object",
    "severity",
    "detectability",
    "failureClass",
    "authorities",
    "remediation",
    "phase"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Stable, layer-prefixed identifier. Never renumbered."
    },
    "slug": {
      "type": "string",
      "description": "Lowercased id; the URL segment."
    },
    "title": {
      "type": "string"
    },
    "statement": {
      "type": "string",
      "description": "The normative requirement, in one sentence."
    },
    "rationale": {
      "type": "string",
      "description": "Why the rule exists and what goes wrong without it."
    },
    "layer": {
      "type": "string",
      "enum": [
        "BRAND",
        "CAMPAIGN",
        "CROSS",
        "MESSAGE_CONTENT",
        "CONSENT_FLOW",
        "WEBSITE",
        "POLICY_PAGE",
        "OPERATIONAL"
      ],
      "description": "Which artifact the rule reads."
    },
    "layerSlug": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "description": "The exact field or artifact checked."
    },
    "severity": {
      "type": "string",
      "enum": [
        "BLOCKING",
        "HIGH",
        "MEDIUM",
        "LOW"
      ]
    },
    "detectability": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "DETERMINISTIC",
          "AI_FORM",
          "CRAWL",
          "VISION",
          "EXTERNAL_DATA",
          "HUMAN",
          "UNDETECTABLE_PRE_SUBMISSION"
        ]
      },
      "description": "How the rule can be settled. Several modes may apply."
    },
    "failureClass": {
      "type": "string",
      "enum": [
        "RETRY_FIELD",
        "TERMINAL_WEBSITE",
        "TERMINAL_POLICY",
        "TERMINAL_ARTIFACT",
        "TERMINAL_EVIDENCE",
        "TERMINAL_EXTERNAL",
        "HARD_STOP"
      ],
      "description": "What a failure means for the fix loop."
    },
    "artifact": {
      "type": "string",
      "description": "Document that discharges the rule, where one exists."
    },
    "authorities": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Who requires this: registry, carrier, provider or regulator."
    },
    "codes": {
      "type": "array",
      "description": "Provider rejection codes for this defect, and whether that provider permits a resubmission.",
      "items": {
        "type": "object",
        "required": [
          "provider",
          "code",
          "remediable"
        ],
        "properties": {
          "provider": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "remediable": {
            "type": "boolean"
          },
          "generation": {
            "type": "string"
          }
        }
      }
    },
    "applicability": {
      "type": "object",
      "description": "Predicate narrowing when the rule fires."
    },
    "applicabilityText": {
      "type": "string",
      "description": "The predicate above, as a sentence."
    },
    "universal": {
      "type": "boolean",
      "description": "True when no predicate narrows the rule."
    },
    "dependsOn": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "remediation": {
      "type": "string",
      "description": "How to fix it, specifically enough to act on."
    },
    "example": {
      "type": "string",
      "description": "A paste-ready example of the fixed state."
    },
    "pitfalls": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "effectiveFrom": {
      "type": "string",
      "format": "date"
    },
    "effectiveTo": {
      "type": "string",
      "format": "date"
    },
    "notes": {
      "type": "string"
    },
    "catalogIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "phase": {
      "type": "string",
      "enum": [
        "approval",
        "post"
      ]
    },
    "automated": {
      "type": "boolean",
      "description": "Whether Ekas settles the rule itself, rather than handing it back to the user to verify."
    },
    "attestation": {
      "type": "object",
      "description": "The check the reader can run themselves. Present on rules no tool can settle (detectability EXTERNAL_DATA or HUMAN), where it is the actionable half of the rule.",
      "required": [
        "question",
        "howToCheck",
        "failureLooksLike"
      ],
      "properties": {
        "question": {
          "type": "string",
          "description": "Phrased so that YES means compliant."
        },
        "howToCheck": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Ordered, concrete steps: the document to open, the number to call, the test to run."
        },
        "failureLooksLike": {
          "type": "string",
          "description": "The specific shape of the failure, so a reader recognises it in their own record."
        }
      }
    }
  }
}
