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

<Hds::Card::Container
  @hasBorder={{true}}
  class="has-padding-m known-secondaries-card {{if this.hasErrorClass 'has-error-border'}}"
>
  <div class="level">
    <h3 class="card-title title is-5">{{this.replicationAttrs.secondaries.length}} Known secondaries</h3>
    <ToolbarLink @route="mode.secondaries" @model={{this.cluster.replicationMode}} data-test-manage-link>
      View all
    </ToolbarLink>
  </div>
  <div class="secondaries-table">
    {{#if this.replicationAttrs.secondaries}}
      <KnownSecondariesTable @secondaries={{this.replicationAttrs.secondaries}} />
    {{else}}
      <Hds::ApplicationState as |A|>
        <A.Header
          @title="No known {{this.cluster.replicationMode}} secondary clusters associated with this cluster"
          data-test-empty-state-title
        />
        <A.Body
          @text="Associated secondary clusters will be listed here. Add your first secondary cluster to get started."
        />
      </Hds::ApplicationState>
    {{/if}}
  </div>
  {{#if this.cluster.canAddSecondary}}
    <LinkTo
      @route="mode.secondaries.add"
      @model={{this.cluster.replicationMode}}
      class="link add-secondaries"
      data-test-link-to="Add secondary"
    >
      Add secondary
    </LinkTo>
  {{/if}}
</Hds::Card::Container>