# {{ workflow.name }}

{% if workflow.metadata and workflow.metadata.get('annotation') %}
{{ workflow.metadata.annotation }}
{% endif %}

**Source:** `{{ workflow.source.path }}`
**Language:** {{ workflow.metadata.get('expression_language', 'Unknown') if workflow.metadata else 'Unknown' }}
**ID:** `{{ workflow.id }}`

## Arguments

{% if workflow.arguments %}
| Name | Type | Direction | Description |
| ---- | ---- | --------- | ----------- |
{% for arg in workflow.arguments %}
| `{{ arg.name }}` | `{{ arg.type }}` | {{ arg.direction }} | {{ arg.annotation if arg.annotation else "-" }} |
{% endfor %}
{% else %}
*No arguments defined*
{% endif %}

## Variables

{% if workflow.variables %}
| Name | Type | Scope | Default |
| ---- | ---- | ----- | ------- |
{% for var in workflow.variables %}
| `{{ var.name }}` | `{{ var.type }}` | {{ var.scope }} | {{ var.default_value if var.default_value else "-" }} |
{% endfor %}
{% else %}
*No variables defined*
{% endif %}

## Dependencies

{% if workflow.dependencies %}
{% for dep in workflow.dependencies %}
- `{{ dep.name }}` ({{ dep.version }})
{% endfor %}
{% else %}
*No dependencies*
{% endif %}

## Activities

{% if workflow.activities %}
*Total: {{ workflow.activities|length }} activities*

{% for activity in workflow.activities %}
### {{ activity.display_name if activity.display_name else activity.type_short }}

**Type:** `{{ activity.type }}`
**ID:** `{{ activity.id }}`
**Depth:** {{ activity.depth }}

{% if activity.annotation %}
{{ activity.annotation }}
{% endif %}

{% if activity.properties and activity.properties|length > 0 %}
**Properties:**
{% for key, value in activity.properties.items() %}
- `{{ key }}`: {{ value }}
{% endfor %}
{% endif %}

{% if activity.expressions and activity.expressions|length > 0 %}
**Expressions:**
{% for expr in activity.expressions %}
- `{{ expr }}`
{% endfor %}
{% endif %}

{% endfor %}
{% else %}
*No activities found*
{% endif %}

## Control Flow

{% if workflow.edges %}
*Total: {{ workflow.edges|length }} edges*

| From | To | Kind | Condition |
| ---- | -- | ---- | --------- |
{% for edge in workflow.edges %}
| {{ edge.from_id }} | {{ edge.to_id }} | {{ edge.kind }} | {{ edge.condition if edge.condition else "-" }} |
{% endfor %}
{% else %}
*No control flow edges*
{% endif %}

## Invocations

{% if workflow.invocations %}
{% for inv in workflow.invocations %}
- Calls `{{ inv.callee_path }}` ({{ inv.callee_id }}) via activity {{ inv.via_activity_id }}
  {% if inv.arguments_passed and inv.arguments_passed|length > 0 %}
  Arguments: {{ inv.arguments_passed|tojson }}
  {% endif %}
{% endfor %}
{% else %}
*No workflow invocations*
{% endif %}

## Issues

{% if workflow.issues %}
{% for issue in workflow.issues %}
- **{{ issue.level|upper }}**: {{ issue.message }}
  {% if issue.location %}
  Location: {{ issue.location }}
  {% endif %}
{% endfor %}
{% else %}
*No issues detected*
{% endif %}

---
*Generated by xaml-parser*
