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

<Identity::EntityNav @identityType={{this.identityType}} @model={{this.model}} />
{{#if this.model.meta.total}}
  {{#each this.model as |item|}}
    <LinkedBlock
      @params={{array "vault.cluster.access.identity.aliases.show" item.id "details"}}
      class="list-item-row"
      data-test-identity-row
    >
      <div class="columns is-mobile">
        <div class="column is-10">
          <LinkTo
            @route="vault.cluster.access.identity.aliases.show"
            @models={{array item.id "details"}}
            class="is-block has-text-black has-text-weight-semibold"
            data-test-identity-link={{item.id}}
          >
            <Icon @name="user" class="has-text-grey-light" />
            <span class="has-text-weight-semibold">{{item.name}}</span>
          </LinkTo>
          <div class="has-text-grey">
            {{item.id}}
          </div>
          <span class="tag">{{item.mountType}}</span>
          <span class="has-text-grey is-size-8">
            {{item.mountAccessor}}
          </span>
        </div>
        <div class="column has-text-right">
          <Identity::PopupAlias @item={{item}} @onSuccess={{action "onDelete"}} />
        </div>
      </div>
    </LinkedBlock>
  {{/each}}

  <Hds::Pagination::Numbered
    @currentPage={{this.model.meta.currentPage}}
    @currentPageSize={{this.model.meta.pageSize}}
    @route="vault.cluster.access.identity.aliases.index"
    @showSizeSelector={{false}}
    @totalItems={{this.model.meta.total}}
    @queryFunction={{this.paginationQueryParams}}
  />

{{else}}
  <EmptyState
    @title="No {{this.identityType}} aliases yet"
    @message="A list of {{this.identityType}} aliases in this namespace will be listed here. Choose one of the {{pluralize
      this.identityType
    }} and click &quot;Add alias&quot; to get started."
  >
    <Hds::Link::Standalone
      @text="Identity: entities and groups tutorial"
      @href={{doc-link "/vault/tutorials/auth-methods/identity"}}
      @icon="learn-link"
      @iconPosition="trailing"
    />
  </EmptyState>
{{/if}}