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

<SecretListHeader
  @model={{this.model}}
  @backendCrumb={{hash
    label=this.model.id
    text=this.model.id
    path="vault.cluster.secrets.backend.list-root"
    model=this.model.id
  }}
  @isConfigure={{true}}
/>

{{#if this.isConfigurable}}
  <Toolbar>
    <ToolbarActions>
      <ToolbarLink
        @route="vault.cluster.settings.configure-secret-backend"
        @model={{this.model.id}}
        data-test-secret-backend-configure
      >
        Configure
      </ToolbarLink>
    </ToolbarActions>
  </Toolbar>
{{/if}}

<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
  {{#each this.model.attrs as |attr|}}
    {{#if (eq attr.type "object")}}
      <InfoTableRow
        @alwaysRender={{not (is-empty-value (get this.model attr.name))}}
        @label={{or attr.options.label (to-label attr.name)}}
        @value={{stringify (get this.model (or attr.options.fieldValue attr.name))}}
      />
    {{else}}
      <InfoTableRow
        @alwaysRender={{and (not (is-empty-value (get this.model attr.name))) (not-eq attr.name "version")}}
        @formatTtl={{eq attr.options.editType "ttl"}}
        @label={{or attr.options.label (to-label attr.name)}}
        @value={{get this.model (or attr.options.fieldValue attr.name)}}
      />
    {{/if}}
  {{/each}}
</div>