{{#if scenarios}}
## Actors and Personas

### System Actors
{{#each (unique_actors scenarios)}}
- {{{actor_link this}}}
{{/each}}

{{#if (has_personas scenarios)}}
### Target Personas
{{#each (unique_personas scenarios)}}
- {{{actor_link this}}}
{{/each}}
{{/if}}

## Scenario Analysis

{{#each scenarios}}
### {{scenario_type}}: {{title}}

**Status:** {{status}}{{#if persona}} | **Persona:** {{actor_emoji persona}} {{persona}}{{/if}}{{#if is_main}} | **Type:** Main Scenario{{/if}}{{#if extends_scenario_id}} | **Extends:** {{extends_scenario_id}}{{/if}}

{{#if extends_scenario_id}}
> **Extension Point:** This scenario diverges from {{extends_scenario_id}} at step {{extends_at_step}}{{#if returns_at_step}} and returns at step {{returns_at_step}}{{else}} (does not return){{/if}}.
{{/if}}

{{#if primary_actor}}
**Primary Actor:** {{{actor_link primary_actor}}}

{{/if}}
{{#if supporting_actors}}
**Supporting Actors:** {{#each supporting_actors}}{{{actor_link this}}}{{#unless @last}}, {{/unless}}{{/each}}

{{/if}}
{{#if preconditions}}
**Preconditions:**
{{#each preconditions}}
- {{this.text}}{{#if this.target_id}} (see [{{this.target_id}}]({{use_case_link this.target_id}})){{/if}}
{{/each}}

{{/if}}
{{#if postconditions}}
**Postconditions:**
{{#each postconditions}}
- {{this.text}}{{#if this.target_id}} (see [{{this.target_id}}]({{use_case_link this.target_id}})){{/if}}
{{/each}}

{{/if}}
#### Business Flow
{{#each steps}}
{{order}}. **{{{actor_name acting_actor}}}** {{action}}{{#if receiving_actor}} to **{{{actor_name receiving_actor}}}**{{/if}}
{{/each}}

{{#if repeat_blocks}}
#### Repeat Blocks
{{#each repeat_blocks}}
- **Steps {{from_step}} to {{to_step}}**: Repeat while *{{condition}}*
{{/each}}

{{/if}}
{{/each}}
{{/if}}
