{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.bseshop.com.tr/schemas/theme-manifest-v1.json",
  "title": "BSE Shop Theme Manifest v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema", "type", "slug", "name", "publisher", "vendor", "version", "requires_core", "requires_php",
    "template_engine", "template_contract", "entry", "parent", "text_domain", "translations", "areas", "supports",
    "assets_manifest", "screenshot", "integrity"
  ],
  "properties": {
    "$schema": { "const": "https://docs.bseshop.com.tr/schemas/theme-manifest-v1.json" },
    "type": { "const": "bse-theme" },
    "slug": { "$ref": "#/$defs/slug" },
    "name": { "type": "string", "minLength": 1, "maxLength": 120 },
    "publisher": { "$ref": "#/$defs/slug" },
    "vendor": { "type": "string", "minLength": 1, "maxLength": 120 },
    "version": { "$ref": "#/$defs/semver" },
    "requires_core": { "$ref": "#/$defs/range" },
    "requires_php": { "$ref": "#/$defs/range" },
    "template_engine": { "const": "php" },
    "template_contract": { "const": 1 },
    "entry": { "$ref": "#/$defs/file" },
    "parent": { "anyOf": [{ "$ref": "#/$defs/slug" }, { "type": "null" }] },
    "text_domain": { "$ref": "#/$defs/slug" },
    "translations": { "$ref": "#/$defs/translations" },
    "areas": { "type": "array", "uniqueItems": true, "items": { "enum": ["footer", "header", "home.hero", "product.after-summary"] } },
    "supports": { "type": "array", "uniqueItems": true, "items": { "enum": ["mini-cart", "product-gallery", "responsive-images"] } },
    "assets_manifest": { "$ref": "#/$defs/file" },
    "screenshot": { "$ref": "#/$defs/file" },
    "integrity": { "$ref": "#/$defs/integrity" }
  },
  "$defs": {
    "slug": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
    "semver": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$" },
    "range": { "type": "string", "pattern": "^(>=|<=|>|<|=)?[0-9]+\\.[0-9]+(\\.[0-9]+)?( ((>=|<=|>|<|=)?[0-9]+\\.[0-9]+(\\.[0-9]+)?))*$" },
    "file": { "type": "string", "pattern": "^(?!/)(?!.*(^|/)\\.\\.(/|$))[A-Za-z0-9._/-]+$" },
    "translations": {
      "type": "object",
      "additionalProperties": false,
      "required": ["format", "default_locale", "locales"],
      "properties": {
        "format": { "const": "json" },
        "default_locale": { "type": "string", "pattern": "^[a-z]{2}(-[A-Z]{2})?$" },
        "locales": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z]{2}(-[A-Z]{2})?$" } }
      }
    },
    "integrity": {
      "type": "object",
      "additionalProperties": false,
      "required": ["algorithm", "files", "signature", "key_id"],
      "properties": {
        "algorithm": { "const": "sha256" },
        "files": { "const": "checksums.json" },
        "signature": { "const": "signature.ed25519" },
        "key_id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{2,127}$" }
      }
    }
  }
}
