{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flowral-app/json-schema/flowral-app-task-schema.json",
  "title": "Task",
  "description": "A unit of work in a flow. Tasks are joined by dependencies: one is ready only when everything it depends on is done, and one with sub-tasks completes through them.",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flowral-app-openapi.json#/components/schemas/Task",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "flowId": {
      "type": "string"
    },
    "parentId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Set when this is a sub-task — the objective it belongs to. Null for an objective itself."
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "blocked",
        "ready",
        "in_progress",
        "done"
      ],
      "description": "Derived from the graph on read, never stored. Work moves ready → in_progress → done; nothing jumps straight to done."
    },
    "dependsOn": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Task ids that must be done first."
    },
    "blockedBy": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Of those, the ones not yet done. Empty when status is not \"blocked\"."
    },
    "assigneeId": {
      "type": [
        "string",
        "null"
      ]
    },
    "estimateHours": {
      "type": [
        "number",
        "null"
      ]
    },
    "criticalPath": {
      "type": "boolean",
      "description": "True when this task is on the chain that decides the flow's finish date."
    },
    "subtasks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SubTask"
      }
    },
    "requiredDeliverables": {
      "type": "array",
      "description": "Files that have to be handed in before the task can complete.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "satisfied": {
            "type": "boolean"
          }
        }
      }
    }
  },
  "required": [
    "id",
    "flowId",
    "parentId",
    "name",
    "status",
    "dependsOn"
  ],
  "$defs": {
    "SubTask": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "done": {
          "type": "boolean"
        },
        "assigneeId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Workspace member id."
        },
        "estimateHours": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "done"
      ]
    }
  }
}