{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/doorloop/main/json-schema/doorloop-task-schema.json",
  "title": "task",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/doorloop-api-reference-openapi.yml#/components/schemas/task",
  "x-stoplight": {
    "id": "p0f9c0fwm79sl"
  },
  "allOf": [
    {
      "properties": {
        "id": {
          "$ref": "#/$defs/mongoId"
        },
        "type": {
          "type": "string",
          "enum": [
            "INTERNAL_TASK",
            "TENANT_REQUEST",
            "OWNER_REQUEST",
            "WORK_ORDER"
          ]
        },
        "reference": {
          "type": "string"
        },
        "subject": {
          "type": "string",
          "maxLength": 255
        },
        "description": {
          "type": "string",
          "maxLength": 10000
        },
        "dueDate": {
          "type": "string",
          "description": "Format: YYYY-MM-DD"
        },
        "status": {
          "type": "string",
          "enum": [
            "NOT_STARTED",
            "RECEIVED",
            "IN_PROGRESS",
            "COMPLETED",
            "ARCHIVED"
          ]
        },
        "priority": {
          "type": "string",
          "enum": [
            "LOW",
            "MEDIUM",
            "HIGH"
          ]
        },
        "requestedByUser": {
          "type": "string",
          "description": "The User Id who requested this task. \nRequired if type == INTERNAL_TASK."
        },
        "requestedByTenant": {
          "type": "string",
          "description": "The Tenant Id who requested this task. \nRequired if type == TENANT_REQUEST."
        },
        "requestedByOwner": {
          "type": "string",
          "description": "The Owner Id who requested this task. \nRequired if type == OWNER_REQUEST."
        },
        "assignedToUsers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/mongoId"
          }
        },
        "property": {
          "$ref": "#/$defs/mongoId"
        },
        "unit": {
          "$ref": "#/$defs/mongoId"
        },
        "notifyTenant": {
          "type": "boolean",
          "description": "If type = TENANT_REQUEST and notifyTenant = \"true\" the tenants will be notified when this task is created or updated."
        },
        "notifyAssignees": {
          "type": "boolean",
          "description": "If set to \"true\", the assigned to users will be notified when this task is created or updated."
        },
        "entryNotes": {
          "type": "string",
          "maxLength": 10000
        },
        "workOrder": {
          "type": "object",
          "description": "Required if type == WORK_ORDER",
          "properties": {
            "assignedToVendor": {
              "$ref": "#/$defs/mongoId"
            },
            "instructionsToVendor": {
              "type": "string",
              "maxLength": 10000
            },
            "approvedByOwner": {
              "type": "boolean"
            },
            "billed": {
              "type": "boolean",
              "description": "Read Only. If billed == true, the Vendor Bill Id be referenced under \"vendorBill\""
            },
            "vendorBill": {
              "$ref": "#/$defs/mongoId"
            }
          },
          "required": [
            "assignedToVendor"
          ]
        },
        "entryPermission": {
          "type": "string",
          "enum": [
            "NOT_APPLICABLE",
            "YES",
            "NO"
          ]
        },
        "createdAt": {
          "type": "number"
        },
        "updatedAt": {
          "type": "number"
        }
      },
      "required": [
        "type",
        "subject",
        "status"
      ]
    }
  ],
  "type": "object",
  "$defs": {
    "mongoId": {
      "type": "string",
      "title": "mongoId",
      "x-stoplight": {
        "id": "40j7qlmpihfdj"
      },
      "pattern": "/^[a-f\\d]{24}$/i"
    }
  }
}