{% import "helpers/no-content.html.nunj" as noContentMacro %}
{% import "helpers/parameters.html.nunj" as parametersMacro %}
{% import "helpers/type.html.nunj" as typeMacro %}
{% import "helpers/code.html.nunj" as codeMacro %}

{% macro render(overloads) %}
    {% for overload in overloads %}
        {% set docNode = overload %}
        {% set parameters = overload.getParameters() %}
        {% set returnsTag = docNode | getJsDocTag('returns') %}

        <table class="ng-doc-overload-table">
            <thead indexable="false">
            <tr>
                <th>Overload #{{ loop.index }}</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>
                    {% set description = docNode | getJsDocDescription %}

                    {{ description if description else noContentMacro.render('No documentation has been provided.') }}

                    {% include "parts/member-remarks.html.nunj" %}
                </td>
            </tr>
            <tr>
                <td>
                    <h5 class="no-anchor" indexable="false">Presentation</h5>
                    {{ codeMacro.render(overload | methodPresentation, "typescript", false) }}
                </td>
            </tr>
            <tr>
                <td>
                    {%- if parameters.length %}
                        <h5 class="no-anchor" indexable="false">Parameters</h5>
                        {{ parametersMacro.render(parameters, docNode) }}
                    {%- endif %}
                    <h5 class="no-anchor" indexable="false">Returns</h5>
                    <div class="ng-doc-returns">
                        {{ typeMacro.returnType(overload) }}
                        {%- if returnsTag.length %}
                            <span> - </span>
                            {{ returnsTag | markdownToHtml }}
                        {%- endif %}
                    </div>
                </td>
            </tr>

            {% include "parts/member-examples.html.nunj" %}

            </tbody>
        </table>
    {% endfor %}
{% endmacro %}

