{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ziggsai-com/json-schema/ziggsai-com-task-read-schema-schema.json",
  "title": "TaskReadSchema",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/ziggsai-com-developer-openapi.json#/components/schemas/TaskReadSchema",
  "type": "object",
  "properties": {
    "control": {
      "type": [
        "object",
        "null"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/TaskControlSchema"
        }
      ]
    },
    "canControl": {
      "type": "boolean"
    },
    "canFinish": {
      "type": "boolean",
      "description": "With includeControlPermission: true when the caller is the assignee side and may mark the task done or failed."
    },
    "taskId": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "agreementId": {
      "type": "string"
    },
    "state": {
      "type": "string"
    },
    "assigneeId": {
      "type": [
        "string",
        "null"
      ]
    },
    "assigneePresentation": {
      "type": "object",
      "additionalProperties": true
    },
    "result": {
      "type": [
        "object",
        "null"
      ]
    },
    "errorMessage": {
      "type": [
        "string",
        "null"
      ]
    },
    "parentTaskId": {
      "type": [
        "string",
        "null"
      ]
    },
    "rootTaskId": {
      "type": [
        "string",
        "null"
      ]
    },
    "requiredInputArtifactIds": {
      "description": "Artifacts this task needs before it runs. A requirement grants no access: each is checked for the assignee audience when the assignment is prepared.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "delegations": {
      "type": "array",
      "description": "Children delegated from this task, by state and returned artifact only.",
      "items": {
        "type": "object",
        "required": [
          "taskId",
          "state",
          "returnedArtifactId"
        ],
        "properties": {
          "taskId": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "returnedArtifactId": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "delegation": {
      "type": [
        "object",
        "null"
      ],
      "description": "Set on a delegated child: the instruction artifact, and the output returned to the parent once it is.",
      "properties": {
        "instructionArtifactId": {
          "type": "string"
        },
        "returnedArtifactId": {
          "type": "string"
        }
      }
    },
    "waitsOn": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "heldByDeps": {
      "type": "boolean"
    },
    "joinKind": {
      "type": "string",
      "enum": [
        "all",
        "any"
      ]
    },
    "closesBy": {
      "type": "string",
      "enum": [
        "result",
        "children"
      ],
      "description": "How this task closes. `result`: by its own result, handed out to its assignee. `children`: a job, which closes when its children close and is never handed out."
    },
    "heldByParentReview": {
      "type": "boolean",
      "description": "True while this task waits for its parent's plan to be acknowledged."
    },
    "runIf": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "A graph step that runs only if a yes/no question holds over the steps it waits on: the question, and once asked, the outcome (run, skipped, held for the buyer, or run by the buyer) with the answer and why."
    },
    "plan": {
      "type": "object",
      "additionalProperties": true
    },
    "planReview": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    },
    "dueAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "checkBack": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    },
    "waitingOn": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    },
    "userOutcomeSatisfaction": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "positive",
        "negative"
      ]
    },
    "userReports": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "history": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "agreement": {
      "type": [
        "object",
        "null"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/TaskAgreementSummarySchema"
        }
      ]
    },
    "creatorIsYou": {
      "type": "boolean"
    },
    "taskCreatorIsYou": {
      "type": "boolean"
    },
    "providerIsYou": {
      "type": "boolean"
    },
    "payerIsYou": {
      "type": "boolean"
    },
    "proposedToIsYou": {
      "type": "boolean"
    }
  },
  "required": [
    "control",
    "taskId",
    "description",
    "title",
    "agreementId",
    "state",
    "assigneeId",
    "result",
    "errorMessage",
    "parentTaskId",
    "rootTaskId",
    "waitsOn",
    "heldByDeps",
    "joinKind",
    "closesBy",
    "heldByParentReview",
    "runIf",
    "plan",
    "planReview",
    "dueAt",
    "checkBack",
    "waitingOn",
    "userOutcomeSatisfaction",
    "userReports",
    "history",
    "createdAt",
    "updatedAt",
    "agreement"
  ],
  "$defs": {
    "TaskAgreementSummarySchema": {
      "type": "object",
      "properties": {
        "agreementId": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "parties": {
          "type": "object",
          "additionalProperties": true
        },
        "counterparty": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "agreementId",
        "description",
        "status",
        "parties",
        "counterparty"
      ]
    },
    "TaskControlSchema": {
      "type": "object",
      "properties": {
        "requestId": {
          "type": "string"
        },
        "action": {
          "type": "string",
          "enum": [
            "pause",
            "resume",
            "stop"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "requested",
            "acknowledged",
            "unsupported"
          ]
        },
        "requestedAt": {
          "type": "string",
          "format": "date-time"
        },
        "acknowledgedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "required": [
        "requestId",
        "action",
        "status",
        "requestedAt",
        "acknowledgedAt"
      ]
    }
  }
}