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

<PageHeader as |p|>
  <p.top>
    <Hds::Breadcrumb>
      <Hds::Breadcrumb::Item
        @text={{capitalize (pluralize this.model.identityType)}}
        @route="vault.cluster.access.identity.index"
      />
      <Hds::Breadcrumb::Item @text={{this.model.name}} @current={{true}} />
    </Hds::Breadcrumb>
  </p.top>
  <p.levelLeft>
    <h1 class="title is-3">
      {{this.model.name}}
    </h1>
  </p.levelLeft>
</PageHeader>
<div class="tabs-container box is-sideless is-fullwidth is-paddingless is-marginless">
  <nav class="tabs sub-nav" aria-label="navigation for managing {{this.model.identityType}}">
    <ul>
      {{#each (tabs-for-identity-show this.model.identityType this.model.type) as |tab|}}
        <LinkTo
          @route="vault.cluster.access.identity.show"
          @models={{array (pluralize this.model.identityType) this.model.id tab}}
          data-test-tab-subnav={{tab}}
        >
          {{capitalize (humanize tab)}}
        </LinkTo>
      {{/each}}
    </ul>
  </nav>
</div>
<Toolbar>
  <ToolbarActions>
    {{! template-lint-disable simple-unless }}
    {{#unless (or (and (eq this.model.identityType "group") (eq this.model.type "internal")) this.model.alias)}}
      <ToolbarLink
        @route="vault.cluster.access.identity.aliases.add"
        @models={{array (pluralize this.model.identityType) this.model.id}}
        @type="add"
        data-test-entity-create-link={{true}}
      >
        Add alias
      </ToolbarLink>
    {{/unless}}
    {{! template-lint-enable simple-unless }}
    <ToolbarLink
      @route="vault.cluster.access.identity.edit"
      @models={{array (pluralize this.model.identityType) this.model.id}}
      data-test-entity-edit-link={{true}}
    >
      Edit
      {{this.model.identityType}}
    </ToolbarLink>
  </ToolbarActions>
</Toolbar>
{{component (concat "identity/item-" this.section) model=this.model}}