{% extends 'base.jinja' %}
{% from 'macros.jinja' import table %}
{% from "nav_artifacts.jinja" import nav %}
{% block title %}{{artifact.name}}{% endblock %}
{% block navigation %}{{ nav(navigation) }}{% endblock %}
{% block report_data %}
            <div class="justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                <h1 class="display-5">{{artifact.report_title if artifact.report_title is defined else artifact.name}}</h1>
                <h6 class="animated fadeIn mb-3">{{artifact.description}}</h6>
            </div>
            {% if artifact.processed %}
            <h6>Total number of entries: {{ artifact.data|length }}</h6>
            {% if artifact.found | length < 5 %}
            <p class="lead">{{ artifact.name }} located at:
                {% set table_data = [] %}
                {% if (artifact.found is not string and artifact.found is not mapping) %}
                    {% for item in artifact.found %}
                        {% set item_path = item.path%}
                        {% if "-" not in item_path.suffix|string %}
                            {% do table_data.append([item_path.resolve()]) %}
                        {% endif %}
                    {% endfor %}
                {% else %}
                    {% set table_data = [artifact.found[0]] %}
                {% endif %}
                {{ table(table_data, ["Paths"]) }}
            </p>
            {% else %}
            <p class="lead">Artifact's source file paths have been hidden and maybe shown in table below or not at all.</p>
            {% endif %}
            {# Prints out each table of data #}
            {% if artifact.data is mapping %}
                {% set count = namespace(value=0) %}
                {% for table_data in artifact.data.items() %}
                    {% set table_headers = artifact.report_headers[count.value] %}
                    {{ table(table_data[1], table_headers) }}
                    {% set count.value = count.value + 1 %}
                {% endfor %}
            {% else %}
                {{ table(artifact.data, artifact.report_headers) }}
            {% endif %}
            {% else %}
            <h6> No files found for artifact!</h6>
            {% endif %}
{% endblock %}