{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "fvcms.cms-local.context-rules.001",
  "title": "Local CMS Module — Context Rules",
  "description": "Per-app rules that decide which chrome shows in which context (page, role, mode). Replaces the vendored rule list.",
  "type": "object",
  "required": ["schema"],
  "properties": {
    "schema": { "const": "fvcms.cms-local.context-rules.001" },
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["when", "then"],
        "properties": {
          "when": {
            "type": "object",
            "description": "Predicate — all listed conditions must match (AND)",
            "properties": {
              "path":     { "type": "string", "description": "URL path glob (e.g. /admin/*)" },
              "role":     { "type": "string" },
              "device":   { "type": "string", "enum": ["mobile", "tablet", "desktop"] },
              "data-fv-region": { "type": "string" },
              "data-fv-mode":   { "type": "string" }
            },
            "additionalProperties": true
          },
          "then": {
            "type": "object",
            "description": "What to do when the predicate matches",
            "properties": {
              "show": { "type": "array", "items": { "type": "string" } },
              "hide": { "type": "array", "items": { "type": "string" } },
              "pin":  { "type": "array", "items": { "type": "string" } }
            }
          }
        }
      }
    }
  },
  "additionalProperties": true
}
