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

<LdapHeader
  @model={{@model.secretsEngine}}
  @promptConfig={{@model.promptConfig}}
  @breadcrumbs={{@breadcrumbs}}
  @configRoute="configuration"
>
  <:toolbarActions>
    {{#if @model.config}}
      <ConfirmAction
        @buttonText="Rotate root"
        class="toolbar-button"
        @buttonColor="secondary"
        @onConfirmAction={{perform this.rotateRoot}}
        @confirmTitle="Rotate root?"
        @confirmMessage="After rotation, Vault will generate a new root password in your directory server."
        @modalColor="warning"
        @isRunning={{this.rotateRoot.isRunning}}
      />
    {{/if}}
    {{#if @model.config}}
      <ToolbarLink @route="configure" data-test-secret-backend-configure>
        Edit configuration
      </ToolbarLink>
    {{/if}}
  </:toolbarActions>
</LdapHeader>

{{#if @model.config}}
  {{#each this.defaultFields as |field|}}
    <InfoTableRow
      @label={{this.label field}}
      @value={{get @model.config field}}
      @formatTtl={{includes field (array "request_timeout" "connection_timeout")}}
      @alwaysRender={{true}}
    />
  {{/each}}

  <h2 class="title is-4 has-top-margin-xl">TLS Connection</h2>
  <hr class="is-marginless" />

  {{#each this.connectionFields as |field|}}
    <InfoTableRow @label={{this.label field}} @value={{get @model.config field}} @alwaysRender={{true}} />
  {{/each}}
{{else if @model.configError}}
  <Page::Error @error={{@model.configError}} />
{{/if}}