{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Issues JSONL Schema",
  "description": "Schema for each line in issues.jsonl (flat storage)",
  "type": "object",
  "required": ["id", "title", "status", "created_at"],
  "properties": {
    "id": {
      "type": "string",
      "description": "Issue ID (e.g., GH-123, TEXT-xxx)"
    },
    "title": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": ["registered", "planning", "planned", "queued", "executing", "completed", "failed", "paused"],
      "default": "registered"
    },
    "priority": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5,
      "default": 3
    },
    "context": {
      "type": "string",
      "description": "Issue context/description (markdown)"
    },
    "bound_solution_id": {
      "type": "string",
      "description": "ID of the bound solution (null if none bound)"
    },
    "solution_count": {
      "type": "integer",
      "default": 0,
      "description": "Number of candidate solutions in solutions/{id}.jsonl"
    },
    "source": {
      "type": "string",
      "enum": ["github", "text", "file"],
      "description": "Source of the issue"
    },
    "source_url": {
      "type": "string",
      "description": "Original source URL (for GitHub issues)"
    },
    "labels": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Issue labels/tags"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "planned_at": {
      "type": "string",
      "format": "date-time"
    },
    "queued_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
