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

<Toolbar>
  <ToolbarActions>
    {{#if this.model.canDelete}}
      <ToolTip @verticalPosition="above" as |T|>
        <T.Trigger tabindex="-1">
          <ConfirmAction
            data-test-oidc-key-delete
            @disabled={{eq this.model.name "default"}}
            @buttonClasses="toolbar-link"
            @onConfirmAction={{this.delete}}
            @confirmTitle="Delete key?"
            @confirmMessage="This key will be permanently deleted. You will not be able to recover it."
            @confirmButtonText="Delete"
          >
            Delete key
          </ConfirmAction>
        </T.Trigger>
        {{#if (eq this.model.name "default")}}
          <T.Content @defaultClass="tool-tip smaller-font">
            <div class="box">
              This is a built-in key that cannot be deleted.
            </div>
          </T.Content>
        {{/if}}
      </ToolTip>
      <div class="toolbar-separator"></div>
    {{/if}}
    {{#if this.model.canRotate}}
      <ConfirmAction
        data-test-oidc-key-rotate
        @buttonClasses="toolbar-link"
        @onConfirmAction={{perform this.rotateKey}}
        @confirmTitle="Rotate this key?"
        @confirmMessage="After rotation, a new public/private key pair will be generated."
        @confirmButtonText="Rotate"
        @isRunning={{this.rotateKey.isRunning}}
      >
        Rotate key
      </ConfirmAction>
    {{/if}}
    {{#if this.model.canEdit}}
      <ToolbarLink @route="vault.cluster.access.oidc.keys.key.edit" @model={{this.model.name}} data-test-oidc-key-edit>
        Edit key
      </ToolbarLink>
    {{/if}}
  </ToolbarActions>
</Toolbar>

<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
  <InfoTableRow @label="Name" @value={{this.model.name}} @alwaysRender={{true}} />
  <InfoTableRow @label="Algorithm" @value={{this.model.algorithm}} @alwaysRender={{true}} />
  <InfoTableRow @label="Rotation period" @value={{format-duration this.model.rotationPeriod}} @alwaysRender={{true}} />
  <InfoTableRow @label="Verification TTL" @value={{format-duration this.model.verificationTtl}} @alwaysRender={{true}} />
</div>