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

<div class="columns">
  <div class="column">
    <PageHeader as |p|>
      <p.top>
        <KeyValueHeader
          @baseKey={{this.model}}
          @path="vault.cluster.secrets.backend.list"
          @mode={{this.mode}}
          @root={{this.backendCrumb}}
          @showCurrent={{true}}
        />
      </p.top>
      <p.levelLeft>
        <h1 class="title is-3">
          <SecretLink
            class="is-inline has-text-info"
            @secret={{this.model.id}}
            @mode="show"
            @replace={{true}}
            @queryParams={{hash tab="actions"}}
            data-test-transit-link="actions"
          >
            <Icon @name="arrow-left" />
          </SecretLink>
          Key Actions
        </h1>
      </p.levelLeft>
    </PageHeader>

    <div class="tabs-container box is-sideless is-fullwidth is-paddingless is-marginless">
      <nav class="tabs">
        <ul>
          {{#each this.model.supportedActions as |supportedAction|}}
            <li class={{if (eq supportedAction.name this.selectedAction) "is-active"}}>
              <SecretLink
                @mode="actions"
                @secret={{this.model.id}}
                @queryParams={{hash action=supportedAction.name}}
                data-test-transit-action-link={{supportedAction.name}}
              >
                {{#if (eq supportedAction.name "export")}}
                  Export Key
                {{else if (eq supportedAction.name "hmac")}}
                  HMAC
                {{else}}
                  {{humanize supportedAction.name}}
                {{/if}}
              </SecretLink>
            </li>
          {{/each}}
        </ul>
      </nav>
    </div>

    <TransitKeyActions
      @selectedAction={{this.selectedAction}}
      @backend={{this.backend}}
      @key={{this.model}}
      @capabilities={{this.capabilities}}
      @onRefresh={{action "refresh"}}
    />
  </div>
</div>