{{!
  Copyright IBM Corp. 2016, 2025
  SPDX-License-Identifier: BUSL-1.1
}}

{{#let (options-for-backend this.effectiveEngineType) as |options|}}
  <Page::Header @title={{@model.id}} @icon={{@model.icon}}>
    <:breadcrumbs>
      <Page::Breadcrumbs @breadcrumbs={{this.breadcrumbs}} />
    </:breadcrumbs>
    <:badges>
      {{#if this.isKV}}
        <Hds::Badge @text="version {{or @model.version '1'}}" data-test-badge="kv version" />
      {{/if}}
    </:badges>
    <:actions>
      {{yield to="actions"}}
    </:actions>
  </Page::Header>

  {{#if options.tabs}}
    <div class="tabs-container box is-bottomless is-marginless is-fullwidth is-paddingless">
      <nav class="tabs" aria-label="secret tabs">
        <ul>
          {{#if options.hasOverview}}
            <li>
              <LinkTo @route="vault.cluster.secrets.backend.overview" @model={{@model.id}} data-test-tab="overview">
                Overview
              </LinkTo>
            </li>
          {{/if}}
          {{#each options.tabs as |oTab|}}
            <li>
              <SecretListHeaderTab
                @displayName={{options.displayName}}
                @id={{@model.id}}
                @path={{oTab.checkCapabilitiesPath}}
                @label={{oTab.label}}
                @tab={{or oTab.tab ""}}
              />
            </li>
          {{/each}}
        </ul>
      </nav>
    </div>
  {{else}}
    {{! if there are no tabs in the options, we'll hardcode them here }}
    <div class="tabs-container box is-bottomless is-marginless is-fullwidth is-paddingless">
      <nav class="tabs" aria-label="tabs">
        <ul>
          {{#if this.showListTab}}
            <li>
              <LinkTo
                @route="vault.cluster.secrets.backend.list-root"
                @model={{@model.id}}
                @current-when="vault.cluster.secrets.backend.list-root vault.cluster.secrets.backend.list"
                data-test-tab={{@model.id}}
              >
                {{capitalize (pluralize options.item)}}
              </LinkTo>
            </li>
          {{/if}}
        </ul>
      </nav>
    </div>
  {{/if}}
{{/let}}