<PageHeader as |p|>
  <p.top>
    <KeyValueHeader @path="vault.cluster.access.methods">
      <li>
        <span class="sep">
          /
        </span>
        <LinkTo @route="vault.cluster.access.methods">
          methods
        </LinkTo>
      </li>
    </KeyValueHeader>
  </p.top>
  <p.levelLeft>
    <h1 class="title is-3">
      {{@methodModel.id}}
    </h1>
  </p.levelLeft>
</PageHeader>
{{#let (tabs-for-auth-section @methodModel "authConfig" @paths) as |tabs|}}
  {{#if tabs.length}}
    <div class="tabs-container box is-sideless is-fullwidth is-paddingless is-marginless">
      <nav class="tabs">
        <ul>
          {{#each tabs as |tab|}}
            <li>
              <LinkTo @route={{get tab.routeParams 0}} @model={{get tab.routeParams 1}} data-test-auth-section-tab={{true}}>
                {{tab.label}}
              </LinkTo>
            </li>
          {{/each}}
        </ul>
      </nav>
    </div>
  {{/if}}
{{/let}}
<Toolbar>
  <ToolbarActions>
    <ToolbarLink
      @route="vault.cluster.access.method.item.create"
      @model={{this.itemType}}
      @type="add"
      data-test-entity-create-link={{this.itemType}}
    >
      Create
      {{singularize this.itemType}}
    </ToolbarLink>
  </ToolbarActions>
</Toolbar>
<ListView
  @items={{this.model}}
  @itemNoun={{this.itemType}}
  @paginationRouteName="vault.cluster.access.method.item.list"
  as |list|
>
  {{#if list.empty}}
    <list.empty
      @title="No {{pluralize this.itemType}} yet"
      @message="A list of {{pluralize
        this.itemType
      }} will be listed here. Create your first {{this.itemType}} to get started."
    >
      <LinkTo @route="vault.cluster.access.method.item.create" @model={{this.itemType}} class="link">
        Create
        {{singularize this.itemType}}
      </LinkTo>
    </list.empty>
  {{else if list.item}}
    <ListItem @linkParams={{array "vault.cluster.access.method.item.show" this.itemType list.item.id}} as |Item|>
      <Item.content>
        <Icon @name="folder" class="has-text-grey-light" />{{list.item.id}}
      </Item.content>
      <Item.menu as |Menu|>
        <li class="action">
          <LinkTo @route="vault.cluster.access.method.item.show" @model={{list.item.id}} class="is-block">
            View
            {{singularize this.itemType}}
          </LinkTo>
        </li>
        <li class="action">
          <LinkTo @route="vault.cluster.access.method.item.edit" @model={{list.item.id}} class="is-block">
            Edit
            {{singularize this.itemType}}
          </LinkTo>
        </li>
        <li>
          <Menu.Message
            @id={{list.item.id}}
            @buttonClasses="link is-destroy"
            @onConfirm={{action
              (perform
                Item.callMethod
                "destroyRecord"
                list.item
                (concat "Successfully deleted " (singularize this.itemType) " " list.item.id ".")
                (concat "There was an error deleting this " (singularize this.itemType))
                (action "refreshItemList")
              )
            }}
            @message={{concat "Are you sure you want to delete " (singularize this.itemType) " " list.item.id "?"}}
            data-test-secret-delete="true"
            @triggerText={{concat "Delete " (singularize this.itemType)}}
          />
        </li>
      </Item.menu>
    </ListItem>
  {{/if}}
</ListView>