{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Kloudy browser publishing envelope — DRAFT, not the canonical KLDY resource schema",
  "description": "Browser proposal accompanying KLDY draft v0.3. Engine resource definitions are pending. Descriptive data confers no execution authority. URLs must be absolute http(s) with no credentials, query or fragment; consumers must also parse them as URLs. Maximum serialized UTF-8 size 1 MiB.",
  "type": "object",
  "additionalProperties": false,
  "required": ["profile", "specVersion", "lane", "resourceSchemaStatus", "source", "ownerReviewed", "resources"],
  "properties": {
    "profile": {"const": "kloudy.publishing/0.1-draft"},
    "specVersion": {"const": "0.3"},
    "lane": {"const": "non-medical"},
    "resourceSchemaStatus": {"const": "pending-engine-definition"},
    "ownerReviewed": {"const": true},
    "source": {
      "type": "object", "additionalProperties": false, "required": ["url", "title"],
      "properties": {
        "url": {"type": "string", "maxLength": 2048, "format": "uri", "pattern": "^https?://[^/?#@\\s]+(?:/[^?#\\s]*)?$"},
        "title": {"$ref": "#/$defs/name"}
      }
    },
    "resources": {"type": "array", "minItems": 1, "maxItems": 24, "items": {"$ref": "#/$defs/candidate"}}
  },
  "$defs": {
    "name": {"type": "string", "minLength": 1, "maxLength": 200, "pattern": "\\S"},
    "detail": {"type": "string", "maxLength": 300},
    "candidate": {
      "type": "object", "additionalProperties": false,
      "required": ["kind", "name", "description", "category", "areaServed", "hours", "evidence"],
      "properties": {
        "kind": {"enum": ["site", "offering"]},
        "name": {"$ref": "#/$defs/name"},
        "description": {"type": "string", "maxLength": 2000},
        "category": {"$ref": "#/$defs/detail"},
        "areaServed": {"$ref": "#/$defs/detail"},
        "hours": {"$ref": "#/$defs/detail"},
        "evidence": {"$ref": "#/$defs/name"}
      }
    }
  }
}
