{{!--
  Renders the sidebar navigation
  @param {object} $context$ the whole swagger definition
  @api public
--}}
<nav id="nav" role="navigation">
  <h5>API Reference</h5>
  <a href="#introduction">Introduction</a>

  {{#if securityDefinitions}}
    <!-- <h5>Security</h5> -->
    <a href="#authentication">Authentication</a>
  {{/if}}

  {{#if showTagSummary}}
    <h5>Operations</h5>
    {{#each tags}}
      <section>
        <a href="#tag-{{htmlId name}}">{{name}}</a>
        <ul>
          {{#each operations}}
            <li>
              {{#if summary}}
                <a href="#operation-{{htmlId path}}-{{htmlId method}}" title="{{summary}}">
                  {{summary}}
                </a>
              {{else}}
                <a href="#operation-{{htmlId path}}-{{htmlId method}}" title="{{toUpperCase method}} {{path}}">
                  {{toUpperCase method}} {{path}}
                </a>
              {{/if}}
            </li>
          {{/each}}
        </ul>
      </section>
    {{/each}}
  {{else}}
    <h5>Paths</h5>
    {{#each paths}}
      <!-- <section>
        <a href="#path-{{htmlId @key}}">{{@key}}</a>
        <ul> -->
          {{#each .}}
            <!-- <li> -->
              {{#if summary}}
                <a href="#operation-{{htmlId path}}-{{htmlId method}}" title="{{summary}}">
                  {{summary}}
                </a>  
              {{else}}
                <a href="#operation-{{htmlId path}}-{{htmlId method}}" title="{{toUpperCase method}} {{path}}">
                  {{toUpperCase method}} {{path}}
                </a>
              {{/if}}
            <!-- </li> -->
          {{/each}}
        <!-- </ul>
      </section> -->
      {{#each .}}
        {{!swagger/operation . operation=. method=@key path=../path}}
      {{/each}}
    {{/each}}
  {{/if}}

  <h5>Schema Definitions</h5>
  {{#each definitions}}
    <a href="#definition-{{htmlId @key}}" title="{{@key}}">
      {{@key}}
    </a>
  {{/each}}
</nav>
