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

<div class="action-block is-rounded" data-test-disable-replication>
  <div class="action-block-info">
    <h3 class="title is-5 is-marginless">
      Disable Replication
    </h3>
    <p class="has-top-padding-s">
      Disable
      {{this.model.replicationModeForDisplay}}
      Replication entirely on the cluster.
    </p>
  </div>

  <div class="action-block-action">
    <Hds::Button
      @text="Disable Replication"
      @color="critical"
      {{on "click" (action (mut this.isModalActive) true)}}
      data-test-replication-action-trigger="disable"
    />
  </div>
</div>

<ConfirmationModal
  @title="Disable Replication?"
  @onClose={{action (mut this.isModalActive) false}}
  @isActive={{this.isModalActive}}
  @confirmText={{this.model.replicationModeForDisplay}}
  @toConfirmMsg="disabling {{this.model.replicationModeForDisplay}} Replication on this cluster"
  @onConfirm={{fn
    (action "onSubmit")
    "disable"
    (if (eq this.model.replicationAttrs.modeForUrl "bootstrapping") this.mode this.model.replicationAttrs.modeForUrl)
  }}
>
  <p class="has-bottom-margin-m">
    {{#if (and this.model.replicationAttrs.isPrimary (eq this.model.replicationMode "dr"))}}
      This cannot be undone.
    {{/if}}
    Disabling
    {{this.model.replicationModeForDisplay}}
    Replication entirely on this
    {{if (eq this.model.replicationAttrs.isPrimary true) "primary" "secondary"}}
    cluster means that:
  </p>
  <ul class="bullet">
    {{#if this.model.replicationAttrs.isPrimary}}
      <li>Secondaries will no longer be able to connect</li>
      <li>Secondaries connecting back to the cluster will require a wipe of the underlying storage</li>
    {{else}}
      <li>We will wipe the underlying storage of this secondary when connected to a primary</li>
    {{/if}}
    <li>Re-enabling this node will change its cluster ID</li>
  </ul>
</ConfirmationModal>