{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kitn.ai/schemas/card/tasks.schema.json",
  "title": "TasksCardData",
  "description": "Data payload for a `tasks` card (CardEnvelope.data when type='tasks').",
  "type": "object",
  "required": ["tasks"],
  "properties": {
    "mode": {
      "type": "string",
      "enum": ["select", "progress"],
      "default": "select",
      "description": "'select' (default) = toggle + a confirm button that emits `submit`. 'progress' = an onboarding-checklist look (header `done / total` count, circular indicators, per-item title/description, no confirm button, where checking a row IS the action). Both share the selection model.",
      "x-kai-mode": true
    },
    "heading": {
      "type": "string",
      "description": "Optional in-body heading; distinct from CardEnvelope.title."
    },
    "tasks": {
      "type": "array",
      "minItems": 1,
      "description": "The selectable rows, rendered in order.",
      "items": {
        "type": "object",
        "required": ["id", "label"],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "description": "Stable id; the selected ids are returned in the result. Unique within `tasks`.",
            "x-kai-unique": true
          },
          "label": { "type": "string", "minLength": 1, "description": "Row label." },
          "description": { "type": "string", "description": "Optional secondary line under the label." },
          "checked": {
            "type": "boolean",
            "default": false,
            "description": "Initial checked state of the row."
          },
          "disabled": {
            "type": "boolean",
            "default": false,
            "description": "Row is shown but not toggleable (and excluded from select-all)."
          }
        }
      }
    },
    "selectAll": {
      "type": "boolean",
      "default": false,
      "description": "Render a master select-all checkbox above the list.",
      "x-kai-control": "select-all"
    },
    "confirmLabel": {
      "type": "string",
      "default": "Confirm",
      "description": "Label for the confirm button."
    },
    "allowEmpty": {
      "type": "boolean",
      "default": false,
      "description": "If true, confirm is enabled with zero selected (emits { selected: [] }). If false, confirm is disabled until >=1 selected."
    },
    "min": {
      "type": "integer",
      "minimum": 0,
      "description": "Optional minimum number that must be selected to confirm.",
      "x-kai-select-min": true
    },
    "max": {
      "type": "integer",
      "minimum": 1,
      "description": "Optional maximum selectable; further toggles are blocked once reached.",
      "x-kai-select-max": true
    },
    "dismissible": {
      "type": "boolean",
      "default": false,
      "description": "Show a close affordance that emits the `dismiss` verb. The card collapses to a re-openable 'dismissed' stub; the host decides via `onReopen` whether it comes back live or `expired`."
    }
  }
}
