{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

<nav class="breadcrumb" aria-label="breadcrumbs" data-test-breadcrumbs>
  <ul>
    {{#each @breadcrumbs as |breadcrumb idx|}}
      <li data-test-crumb="{{idx}}">
        <span class="sep">/</span>
        {{#if breadcrumb.linkExternal}}
          <LinkToExternal @route={{breadcrumb.route}} data-test-breadcrumb={{breadcrumb.label}}>
            {{breadcrumb.label}}
          </LinkToExternal>
        {{else if breadcrumb.route}}
          {{#if breadcrumb.model}}
            <LinkTo @route={{breadcrumb.route}} @model={{breadcrumb.model}} data-test-breadcrumb={{breadcrumb.label}}>
              {{breadcrumb.label}}
            </LinkTo>
          {{else}}
            <LinkTo @route={{breadcrumb.route}} data-test-breadcrumb={{breadcrumb.label}}>
              {{breadcrumb.label}}
            </LinkTo>
          {{/if}}
        {{else}}
          {{breadcrumb.label}}
        {{/if}}
      </li>
    {{/each}}
  </ul>
</nav>