<div class="action-block is-rounded" data-test-demote-replication>
  <div class="action-block-info">
    <h4 class="title is-5 is-marginless">
      Demote cluster
    </h4>
    <p>
      Demote this
      {{this.model.replicationModeForDisplay}}
      primary to a secondary.
    </p>
  </div>
  <div class="action-block-action">
    <button
      type="button"
      class="button is-secondary"
      onclick={{action (mut this.isModalActive) true}}
      data-test-replication-action-trigger
    >
      Demote
    </button>
  </div>
</div>

<ConfirmationModal
  @title="Demote to secondary?"
  @onClose={{action (mut this.isModalActive) false}}
  @isActive={{this.isModalActive}}
  @buttonClass="is-primary"
  @confirmText={{this.model.replicationModeForDisplay}}
  @toConfirmMsg="demoting this cluster"
  @onConfirm={{action "onSubmit" "demote" this.model.replicationAttrs.modeForUrl}}
>
  <p class="has-bottom-margin-m">
    {{#if (and (eq this.replicationMode "dr") (not this.model.performance.replicationDisabled))}}
      <p class="has-bottom-margin-m" data-test-demote-warning>
        This cluster is currently operating as a performance secondary. Demoting it will leave your replication setup
        <strong>without a performance primary cluster</strong>
        until a new cluster is promoted.
      </p>
    {{/if}}
    Demoting this
    {{this.model.replicationModeForDisplay}}
    primary to a
    {{this.model.replicationModeForDisplay}}
    secondary means that the resulting secondary cluster:
  </p>
  <ul class="bullet has-bottom-margin-m">
    {{#if (and (eq this.replicationMode "dr") (not this.model.performance.replicationDisabled))}}
      <li>Will be read-only</li>
    {{/if}}
    <li>Will not attempt to connect to a primary</li>
    <li>Will maintain knowledge of its cluster ID</li>
    <li>Can be reconnected to the same set of replication clusters without wiping local storage.</li>
  </ul>
  <p class="has-bottom-margin-m">
    To connect the resulting secondary to a new primary, use the Update primary action.
  </p>
</ConfirmationModal>