{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "MORPH-SPEC tasks.json",
  "description": "Structured task list for a morph-spec feature. Replaces tasks.md.",
  "type": "object",
  "required": ["version", "feature", "tasks"],
  "properties": {
    "version": { "type": "string", "const": "1.0" },
    "feature": { "type": "string", "minLength": 1 },
    "tasks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "title", "description", "dependencies", "effort", "doneCriteria", "status"],
        "properties": {
          "id": { "type": "string", "pattern": "^T\\d+$" },
          "title": { "type": "string", "minLength": 1 },
          "description": { "type": "string", "minLength": 1 },
          "dependencies": {
            "type": "array",
            "items": { "type": "string", "pattern": "^T\\d+$" }
          },
          "effort": { "type": "string", "enum": ["S", "M", "L", "XL"] },
          "doneCriteria": { "type": "string", "minLength": 1 },
          "status": { "type": "string", "enum": ["pending", "in_progress", "done", "skipped", "blocked"] },
          "outputs": { "type": "array", "items": { "type": "string" } },
          "notes": { "type": "string" },
          "group": { "type": "string", "enum": ["backend", "frontend", "tests", "infra", "docs"] },
          "usecase": {
            "type": "string",
            "pattern": "^UC-\\d+$",
            "description": "ID of the use case this task realizes (2-plan/usecases/UC-{nn}-{slug}.md). Optional: technical tasks with no observable behaviour have none."
          },
          "agent": {
            "type": "string",
            "minLength": 1,
            "description": "Persona id assigned by morph-plan for this task — the bare framework/agents.json id, no 'morph-' prefix (e.g. \"dotnet-senior\"). Optional. Part of the plan contract: frozen after Gate 2."
          },
          "reuse": {
            "type": "array",
            "description": "Veredito de reuso por conceito que ESTA task introduz, carimbado por morph-plan a partir do 2-plan/reuse-map.md. Optional. Part of the plan contract: frozen after Gate 2. A justificativa de um CRIAR mora no reuse-map.md, nunca aqui — duas verdades do mesmo fato divergem.",
            "items": {
              "type": "object",
              "required": ["concept", "verdict"],
              "properties": {
                "concept": {
                  "type": "string",
                  "minLength": 1,
                  "description": "Nome do conceito/símbolo, como ele aparecerá no código (ex.: \"SimpleBuilding\")."
                },
                "verdict": {
                  "type": "string",
                  "enum": ["REUSAR", "ESTENDER", "CRIAR"],
                  "description": "REUSAR: usar o que existe. ESTENDER: partir do que existe. CRIAR: nada cobre o caso — exige justificativa de uma linha no reuse-map.md."
                },
                "target": {
                  "type": "string",
                  "description": "Path (ou path:símbolo) do que será reusado/estendido. Vazio ou ausente em CRIAR."
                }
              },
              "additionalProperties": false
            }
          },
          "standards": {
            "type": "array",
            "items": { "type": "string", "minLength": 1 },
            "description": "Standards pinned by morph-plan for this task, as PATHS relative to the framework root (e.g. \"standards/backend/dotnet/vsa-handler-patterns.md\"). Optional. Part of the plan contract: frozen after Gate 2. NOT the same vocabulary as agents.json's top-level `standards` field, which lists IDs (e.g. \"backend-dotnet-vsa-handler-patterns\", no slashes/extension) — same field name, different shape; do not treat one as the other."
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
