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

<Page::Header @icon="certificate" @title="Automatic Tidy Configuration">
  <:breadcrumbs>
    <Page::Breadcrumbs @breadcrumbs={{@breadcrumbs}} />
  </:breadcrumbs>
</Page::Header>

<Toolbar>
  <ToolbarActions>
    <LinkTo @route="tidy.auto.configure" @model={{@backend}} class="toolbar-link" data-test-pki-edit-tidy-auto-link>
      Edit auto-tidy
      <Icon @name="chevron-right" />
    </LinkTo>
  </ToolbarActions>
</Toolbar>

<main>
  {{#each (tidy-groups) as |group|}}
    {{#each-in group as |label fields|}}
      {{#if (not-eq label "default")}}
        <h2 class="title is-5 has-top-margin-l has-bottom-margin-xs" data-test-group-title={{label}}>
          {{label}}
        </h2>
      {{/if}}

      {{#each fields as |field|}}
        <InfoTableRow
          @label={{tidy-field-label field}}
          @value={{get @model field}}
          @formatTtl={{includes
            field
            (array
              "acme_account_safety_buffer"
              "interval_duration"
              "min_startup_backoff_duration"
              "max_startup_backoff_duration"
              "issuer_safety_buffer"
              "pause_duration"
              "revocation_queue_safety_buffer"
              "safety_buffer"
            )
          }}
          data-test-row={{field}}
        />
      {{/each}}
    {{/each-in}}
  {{/each}}
</main>