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

{{#if this.isIdle}}
  <Hds::Button
    data-test-idle-button
    @size={{@size}}
    @text={{@idleText}}
    @color="critical"
    disabled={{@disabled}}
    {{on "click" this.promptForConfirmation}}
  />
{{else if this.isPendingConfirmation}}
  <span
    data-test-confirmation-message
    class="confirmation-text {{this.classes.confirmationMessage}} {{if this.alignRight "is-right-aligned"}} {{if this.inlineText "has-text-inline"}}">
    {{this.confirmationMessage}}
  </span>
  <Hds::Button
    data-test-cancel-button
    @size={{@size}}
    @text={{@cancelText}}
    @color="secondary"
    class="is-inline"
    disabled={{this.awaitingConfirmation}}
    {{on "click" (queue
      (action this.setToIdle)
      (action this.onCancel)
    )}}
  />
  <Hds::Button
    data-test-confirm-button
    @size={{@size}}
    @text={{if this.awaitingConfirmation "Loading..." @confirmText}}
    @color="critical"
    class="is-inline"
    disabled={{this.awaitingConfirmation}}
    {{on "click" (queue
      (action this.setToIdle)
      (action this.onConfirm)
    )}}
  />
{{/if}}
