{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "review-checklist-schema-v2",
  "title": "Review Checklist Schema (Real-Time Generation)",
  "description": "JSON Schema for review-checklist.json - contextual review questions generated in real-time during task execution",
  "type": "object",
  "required": ["$schema", "task", "generated", "items"],
  "properties": {
    "$schema": {
      "type": "string",
      "const": "review-checklist-schema-v2",
      "description": "Schema identifier"
    },
    "task": {
      "type": "string",
      "pattern": "^TASK\\d+$",
      "description": "Task identifier (e.g., TASK0, TASK1)"
    },
    "generated": {
      "type": "string",
      "format": "date-time",
      "description": "ISO timestamp when checklist was initialized"
    },
    "items": {
      "type": "array",
      "description": "Review checklist items - generated in real-time as files are created/modified",
      "items": {
        "type": "object",
        "required": ["id", "file", "lines", "type", "description", "reviewed", "category", "context"],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^RC\\d+$",
            "description": "Review checklist item identifier (e.g., RC1, RC2)"
          },
          "file": {
            "type": "string",
            "description": "File path related to this review item"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1
            },
            "minItems": 1,
            "description": "Specific line numbers to review (REQUIRED - use file:line references)"
          },
          "type": {
            "type": "string",
            "enum": ["created", "modified"],
            "description": "Whether file was created or modified"
          },
          "description": {
            "type": "string",
            "minLength": 20,
            "pattern": "^[^`]*$",
            "description": "Review question - must use file:line references, NO inline code (backticks)"
          },
          "reviewed": {
            "type": "boolean",
            "default": false,
            "description": "Whether this item has been reviewed"
          },
          "category": {
            "type": "string",
            "enum": [
              "compatibility",
              "breaking-change",
              "completeness",
              "data-flow",
              "error-handling",
              "integration",
              "testing"
            ],
            "description": "Category of review concern"
          },
          "context": {
            "type": "object",
            "required": ["action", "why"],
            "description": "Context about what was done and why - captures implementation intent",
            "properties": {
              "action": {
                "type": "string",
                "minLength": 5,
                "description": "What action was performed (e.g., 'Added input validation for userId')"
              },
              "why": {
                "type": "string",
                "minLength": 5,
                "description": "Why this action was needed (e.g., 'Prevent SQL injection')"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
