{%- macro space(count) -%}{% for i in range(0, count)%}  {% endfor %}{%- endmacro -%}
{%- macro print_components(model, indent_level) %}
{%- for interface in model.interfaces -%}
{{space(indent_level)}}interface {{interface}}
{% endfor -%}
{%- if model.components|length > 0 %}
{{space(indent_level)}}component "{{model.name}}" {
{% for component in model.components -%}
{{print_components(component, indent_level + 1)}}
{% endfor -%}
{{space(indent_level)}}}
{% else -%}
{{space(indent_level)}}component "{{model.name}}"
{% endif -%}

{%- for input in model.inputs -%}
{{space(indent_level)}}{{input.type}} --> {{input.target}} : {{input.name}}
{% endfor -%}

{%- for output in model.outputs -%}
{{space(indent_level)}}{{output.source}} --> {{output.type}} : {{output.name}}
{% endfor -%}
{%- endmacro -%}
{% if model.classification %}##### {{model.classification}} #####{% endif %}

@startuml {{model.name}} Component Diagram
title {{model.name}} Component Diagram

{{print_components(model, 0)}}
@enduml

{% if model.classification %}##### {{model.classification}} #####{% endif %}
