{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "execkernel_template_manifest_schema.json",
  "title": "ExecKernel Template Manifest",
  "description": "Schema canónico para validar manifests de templates de ExecKernel.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "templateCode",
    "version",
    "family",
    "status",
    "supportedFormats",
    "description"
  ],
  "properties": {
    "templateCode": {
      "type": "string",
      "description": "Identificador del template con formato {family}_{use_case}_{version}.",
      "pattern": "^(wizard|decision_tree|eligibility|funnel)_[a-z0-9]+(?:_[a-z0-9]+)*_v\\d+(?:\\.\\d+){0,2}$"
    },
    "version": {
      "type": "string",
      "description": "Versión SemVer con prefijo v (ej: v1, v1.2, v1.2.3).",
      "pattern": "^v\\d+(?:\\.\\d+){0,2}$"
    },
    "family": {
      "type": "string",
      "description": "Familia canónica del template.",
      "enum": ["wizard", "decision_tree", "eligibility", "funnel"]
    },
    "status": {
      "type": "string",
      "description": "Estado de publicación del template.",
      "enum": ["pending", "published"]
    },
    "supportedFormats": {
      "type": "array",
      "description": "Formatos disponibles para el template.",
      "items": {
        "type": "string",
        "enum": ["json", "dsl", "mermaid"]
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "description": {
      "type": "string",
      "description": "Resumen funcional del template.",
      "minLength": 1
    }
  }
}
