# Enhanced Template Example with Jinja2

This template demonstrates the advanced capabilities enabled by Jinja2 integration.

## Project: {{ project_name | upper }}

**Generated**: {{ date }}
**Version**: {{ version | default('1.0.0') }}

---

## Feature Summary

{% if actor_count > 0 %}
### Actors ({{ actor_count }} total)

This project has identified {{ actor_count }} actor{% if actor_count != 1 %}s{% endif %}:

{% for actor in actors %}
- **{{ actor.name }}** ({{ actor.type | replace('_', ' ') | title }})
  - Access Level: {{ actor.access_level }}
  {% if actor.description %}
  - Description: {{ actor.description }}
  {% endif %}
{% endfor %}
{% else %}
*No actors have been identified yet.*
{% endif %}

---

{% if endpoints %}
## API Endpoints ({{ endpoints | length }})

The following endpoints are available:

| Method | Path | Authenticated | Description |
|--------|------|---------------|-------------|
{% for endpoint in endpoints %}
| {{ endpoint.method }} | {{ endpoint.path }} | {% if endpoint.authenticated %}🔒 Yes{% else %}No{% endif %} | {{ endpoint.description | default('N/A') }} |
{% endfor %}

### Endpoint Statistics

- Total endpoints: {{ endpoints | length }}
- Authenticated endpoints: {{ endpoints | selectattr('authenticated') | list | length }}
- Public endpoints: {{ endpoints | rejectattr('authenticated') | list | length }}

### HTTP Methods Used

{% for method in ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] %}
{% set count = endpoints | selectattr('method', 'equalto', method) | list | length %}
{% if count > 0 %}
- **{{ method }}**: {{ count }} endpoint{% if count != 1 %}s{% endif %}
{% endif %}
{% endfor %}

{% else %}
*No endpoints discovered in this project.*
{% endif %}

---

{% if models %}
## Data Models ({{ models | length }})

{% for model in models %}
### {{ loop.index }}. {{ model.name }}

- **Fields**: {{ model.fields }}
- **Location**: `{{ model.location }}`
{% if model.relationships %}
- **Relationships**: {{ model.relationships | join(', ') }}
{% endif %}

{% endfor %}
{% else %}
*No data models found.*
{% endif %}

---

## Quality Metrics

{% if test_coverage %}
### Test Coverage

- Overall: {{ test_coverage.overall }}%
{% if test_coverage.overall >= 80 %}
- Status: ✅ **Excellent** - Well tested codebase
{% elif test_coverage.overall >= 60 %}
- Status: ⚠️ **Good** - Consider adding more tests
{% else %}
- Status: ❌ **Needs Improvement** - Low test coverage
{% endif %}
{% endif %}

{% if code_quality %}
### Code Quality

{% for metric, value in code_quality.items() %}
- {{ metric | replace('_', ' ') | title }}: {{ value }}
{% endfor %}
{% endif %}

---

## Recommendations

{% if recommendations %}
{% for category, items in recommendations.items() %}
### {{ category | title }}

{% for item in items %}
{{ loop.index }}. {{ item }}
{% endfor %}

{% endfor %}
{% else %}
*No recommendations at this time.*
{% endif %}

---

## Summary

This analysis found:
{% if actor_count > 0 %}- {{ actor_count }} actor(s){% endif %}
{% if endpoints %}- {{ endpoints | length }} API endpoint(s){% endif %}
{% if models %}- {{ models | length }} data model(s){% endif %}

{% if actor_count == 0 and (endpoints | length) == 0 and (models | length) == 0 %}
*Project analysis is incomplete. Please run a full analysis.*
{% else %}
*Analysis complete. Review the sections above for detailed information.*
{% endif %}

---

*Generated by RE-cue with Jinja2 templating*
