{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eightfold-ai/json-schema/eightfold-ai-approval-workflow-schema-schema.json",
  "title": "ApprovalWorkflowSchema",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eightfold-ai-approval-workflow-api-openapi.yml#/components/schemas/ApprovalWorkflowSchema",
  "type": "object",
  "properties": {
    "status": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "Current status of the approval workflow."
    },
    "createdAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "readOnly": true,
      "description": "Datetime when the approval workflow was created"
    },
    "entityType": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "Type of the entity associated with the approval workflow."
    },
    "entityId": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "readOnly": true,
      "description": "ID of the entity associated with the approval workflow."
    },
    "approvalWorkflowId": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int32",
      "readOnly": true,
      "description": "ID of the approval workflow."
    },
    "steps": {
      "readOnly": true,
      "description": "List of approval steps. The entity is considered approved only if all steps are approved.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/ApprovalStep"
      }
    },
    "groupId": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "Group id"
    },
    "updatedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "readOnly": true,
      "description": "Datetime when the approval workflow was last updated"
    },
    "triggerApproval": {
      "type": [
        "boolean",
        "null"
      ],
      "writeOnly": true,
      "description": "Whether to initiate the approval process. If true, emails will be sent to approvers."
    }
  },
  "$defs": {
    "ApprovalStep": {
      "type": "object",
      "properties": {
        "status": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Status of the approval step."
        },
        "approvers": {
          "readOnly": true,
          "description": "List of approvers assigned to this step.",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Approver"
          }
        },
        "approvalCount": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32",
          "readOnly": true,
          "description": "Number of approvals required for this step to be considered approved."
        },
        "approvalCondition": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Condition under which the step is considered approved."
        }
      }
    },
    "Approver": {
      "type": "object",
      "properties": {
        "status": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Approval status for the approver."
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Email address of the approver."
        }
      }
    }
  }
}