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

{{#if @replicationDisabled}}
  <Page::Header @title={{this.title}}>
    <:breadcrumbs>
      <Page::Breadcrumbs
        @breadcrumbs={{array (hash label="Vault" route="vault" icon="vault" linkExternal=true) (hash label=this.title)}}
      />
    </:breadcrumbs>
  </Page::Header>

  <div class="box is-sideless is-fullwidth is-marginless">
    {{#if (eq @replicationMode "dr")}}
      <h2 class="title is-flex-center is-5 is-marginless">
        <Icon @size="24" @name="replication-direct" />
        Disaster recovery (DR) replication
      </h2>
      <p class="help has-text-grey-dark">
        {{replication-mode-description "dr"}}
      </p>
    {{else if (eq @replicationMode "performance")}}
      <h2 class="title is-flex-center is-5 is-marginless">
        <Icon @size="24" @name="replication-perf" />
        Performance replication
      </h2>
      {{#if (has-feature "Performance Replication")}}
        <p class="help has-text-grey-dark">
          {{replication-mode-description "performance"}}
        </p>
      {{else}}
        <p class="help has-text-grey-dark">
          Performance replication is a feature of Vault Enterprise Premium
        </p>
      {{/if}}
    {{/if}}
  </div>
  <EnableReplicationForm
    @replicationMode={{@replicationMode}}
    @canEnablePrimary={{this.canEnable "Primary"}}
    @canEnableSecondary={{this.canEnable "Secondary"}}
    @performanceReplicationDisabled={{@cluster.performance.replicationDisabled}}
    @performanceMode={{if @cluster.performance.replicationDisabled "disabled" @cluster.performance.modeForUrl}}
    @onSuccess={{@onEnableSuccess}}
  />
{{else}}
  <ReplicationSummary @cluster={{@cluster}} @initialReplicationMode={{@replicationMode}} />
{{/if}}