{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://decantr.ai/schemas/archetype.v2.json",
  "title": "Decantr Archetype",
  "type": "object",
  "required": [
    "$schema",
    "id",
    "role",
    "version",
    "name",
    "description",
    "tags",
    "pages",
    "features"
  ],
  "properties": {
    "$schema": {
      "const": "https://decantr.ai/schemas/archetype.v2.json"
    },
    "id": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString"
    },
    "version": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString"
    },
    "decantr_compat": {
      "type": "string"
    },
    "name": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString"
    },
    "description": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString"
    },
    "tags": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyStringArray"
    },
    "role": {
      "enum": [
        "primary",
        "gateway",
        "public",
        "auxiliary"
      ]
    },
    "pages": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "default_layout",
          "shell"
        ],
        "properties": {
          "id": {
            "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString"
          },
          "shell": {
            "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString"
          },
          "description": {
            "type": "string"
          },
          "patterns": {
            "type": "array",
            "items": {
              "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/patternReference"
            }
          },
          "default_layout": {
            "type": "array",
            "items": {
              "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/layoutItem"
            }
          },
          "directives": {
            "type": "array",
            "description": "Per-page execution directives. Propagated to essence.blueprint.sections[].pages[].directives and rendered into the page-pack markdown.",
            "items": { "type": "string", "minLength": 1 }
          }
        },
        "additionalProperties": true
      }
    },
    "features": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyStringArray"
    },
    "directives": {
      "type": "array",
      "description": "Section-level execution directives. Propagated to essence.blueprint.sections[].directives and rendered into the section-pack markdown.",
      "items": { "type": "string", "minLength": 1 }
    },
    "navigation_items": {
      "type": "array",
      "description": "Items rendered in the shell's primary navigation when this archetype is composed as a section. Propagated to essence.blueprint.sections[].navigation_items.",
      "items": {
        "type": "object",
        "required": ["label", "route"],
        "additionalProperties": false,
        "properties": {
          "label": { "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString" },
          "route": { "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyString" },
          "icon": { "type": "string", "minLength": 1 },
          "hotkey": { "type": "string", "minLength": 1 },
          "active_match": { "type": "string", "minLength": 1 },
          "badge": { "type": "string", "minLength": 1 }
        }
      }
    },
    "dependencies": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        }
      }
    },
    "seo_hints": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/seoHints"
    },
    "classification": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/classification"
    },
    "page_briefs": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/stringMap"
    },
    "suggested_theme": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/suggestedTheme"
    },
    "shells": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/stringMap"
    },
    "personality": {
      "$ref": "https://decantr.ai/schemas/common.v1.json#/$defs/nonEmptyStringArray"
    },
    "hero_customization": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
