arazzo: 1.0.1 info: title: Workday Staff Against Labor Demand summary: Read labor demand for an organization, check existing coverage, and schedule a shift only when demand exists. description: >- Drives demand-based scheduling by reading planned labor demand for a scheduling organization, listing the shifts already scheduled in that window, and creating a new shift to add coverage only when labor demand is present. The workflow branches on whether any labor demand exists. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: schedulingApi url: ../openapi/workday-tracking-system-scheduling-openapi.yml type: openapi workflows: - workflowId: staff-against-labor-demand summary: Read demand, review coverage, and add a shift when demand exists. description: >- Lists labor demand for an organization, lists existing shifts for the same window, and creates a covering shift only when there is demand to staff. inputs: type: object required: - bearerToken - organizationId - startDate - endDate - workerId - shiftDate - startTime - endTime properties: bearerToken: type: string description: OAuth 2.0 JWT bearer token for authenticating with Workday. organizationId: type: string description: Scheduling organization ID to staff. startDate: type: string description: Start date for demand and shift retrieval (YYYY-MM-DD). endDate: type: string description: End date for demand and shift retrieval (YYYY-MM-DD). workerId: type: string description: Worker ID to assign to the covering shift. shiftDate: type: string description: Date of the covering shift (YYYY-MM-DD). startTime: type: string description: Covering shift start time (HH:MM:SS). endTime: type: string description: Covering shift end time (HH:MM:SS). steps: - stepId: readDemand description: >- Read labor demand instances for the scheduling organization within the planning window. operationId: listLaborDemand parameters: - name: Authorization in: header value: Bearer $inputs.bearerToken - name: organizationId in: query value: $inputs.organizationId - name: startDate in: query value: $inputs.startDate - name: endDate in: query value: $inputs.endDate successCriteria: - condition: $statusCode == 200 outputs: demandTotal: $response.body#/total onSuccess: - name: hasDemand type: goto stepId: reviewCoverage criteria: - context: $response.body condition: $.data.length > 0 type: jsonpath - name: noDemand type: end criteria: - context: $response.body condition: $.data.length == 0 type: jsonpath - stepId: reviewCoverage description: >- List the shifts already scheduled for the organization in the same window to understand current coverage before adding more. operationId: listScheduleShifts parameters: - name: Authorization in: header value: Bearer $inputs.bearerToken - name: organizationId in: query value: $inputs.organizationId - name: startDate in: query value: $inputs.startDate - name: endDate in: query value: $inputs.endDate successCriteria: - condition: $statusCode == 200 outputs: existingShiftTotal: $response.body#/total - stepId: addCoverageShift description: >- Create a new schedule shift to add coverage against the open labor demand. operationId: createScheduleShift parameters: - name: Authorization in: header value: Bearer $inputs.bearerToken requestBody: contentType: application/json payload: workerId: $inputs.workerId organizationId: $inputs.organizationId shiftDate: $inputs.shiftDate startTime: $inputs.startTime endTime: $inputs.endTime successCriteria: - condition: $statusCode == 201 outputs: shiftId: $response.body#/id shiftWorkerId: $response.body#/workerId outputs: demandTotal: $steps.readDemand.outputs.demandTotal shiftId: $steps.addCoverageShift.outputs.shiftId