{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Reversa Docs Config",
  "description": "Configuração persistida em _reversa_docs/.config.json após a entrevista do /reversa-docs. Reusada por execuções subsequentes e por agentes isolados.",
  "type": "object",
  "required": ["schemaVersion", "generatedAt", "projectName", "interview", "seed", "knowledgeSources"],
  "properties": {
    "schemaVersion": {
      "type": "integer",
      "const": 1,
      "description": "Versão do schema. Incrementar quando houver breaking change."
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 do momento em que a entrevista foi conduzida."
    },
    "reversa": {
      "type": "object",
      "properties": {
        "version": { "type": "string" }
      }
    },
    "projectName": {
      "type": "string",
      "description": "Nome do projeto. Vem do soul.md se houver, senão do nome da pasta raiz."
    },
    "interview": {
      "type": "object",
      "required": ["readerProfile", "depth", "visualStyle"],
      "properties": {
        "readerProfile": {
          "type": "string",
          "enum": ["novo_dev", "stakeholder", "auditor", "other"]
        },
        "readerProfileFreeform": {
          "type": "string",
          "description": "Texto livre quando readerProfile = other."
        },
        "depth": {
          "type": "string",
          "enum": ["overview", "full", "features_selection", "other"]
        },
        "depthFreeform": {
          "type": "string"
        },
        "selectedFeatures": {
          "type": "array",
          "items": { "type": "string" },
          "description": "IDs das specs escolhidas quando depth = features_selection."
        },
        "visualStyle": {
          "type": "string",
          "enum": ["sober", "premium", "dense", "exploratory", "other"]
        },
        "visualStyleFreeform": {
          "type": "string"
        }
      }
    },
    "seed": {
      "type": "object",
      "required": ["hash", "source"],
      "properties": {
        "hash": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$"
        },
        "source": {
          "type": "string",
          "enum": ["soul.md", "project_name"]
        },
        "explicitOverride": {
          "type": ["string", "null"],
          "description": "Valor passado via --seed=<valor>, sobrescreve hash calculado."
        }
      }
    },
    "knowledgeSources": {
      "type": "object",
      "properties": {
        "soul": { "type": "boolean" },
        "chronicle": { "type": "boolean" },
        "topology": { "type": "boolean" },
        "sddSpecs": {
          "type": "array",
          "items": { "type": "string" }
        },
        "sourceCode": { "type": "boolean" }
      }
    },
    "pagesPlanned": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Paths relativos das páginas que serão geradas, decidido após a entrevista."
    },
    "pagesOmitted": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "page": { "type": "string" },
          "reason": { "type": "string" }
        }
      }
    }
  }
}
