# Simple Workflow for End-to-End Integration Testing
# Tests sequential task execution, variable passing, and workflow completion

name: simple_workflow
description: "Simple 3-task workflow for testing workflow orchestration"
version: "1.0.0"

# Input parameters for the workflow
input:
  - workflow_message
  - workflow_delay

# Workflow variables (initialized at start)
vars:
  - start_time: null
  - task_count: 3

# Workflow tasks
tasks:
  # Task 1: Echo the start message
  task_start:
    action: test_pack.echo
    input:
      message: "{{ _.workflow_message or 'Starting workflow...' }}"
      delay: 0
      fail: false
    publish:
      - start_time: "{{ task_start.result.timestamp }}"
    on-success:
      - task_wait

  # Task 2: Wait for specified delay
  task_wait:
    action: test_pack.echo
    input:
      message: "Waiting {{ _.workflow_delay or 2 }} seconds..."
      delay: "{{ _.workflow_delay or 2 }}"
      fail: false
    on-success:
      - task_complete

  # Task 3: Complete the workflow
  task_complete:
    action: test_pack.echo
    input:
      message: "Workflow completed successfully! Started at {{ _.start_time }}"
      delay: 0
      fail: false

# Workflow output (what to return when complete)
output:
  workflow_result: "{{ task_complete.result.message }}"
  total_tasks: "{{ _.task_count }}"
  start_time: "{{ _.start_time }}"
  end_time: "{{ task_complete.result.timestamp }}"
  all_tasks_succeeded: true
