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

{{#if @model.hasMembers}}
  {{#each @model.memberGroupIds as |gid|}}
    <LinkedBlock @params={{array "vault.cluster.access.identity.show" "groups" gid this.details}} class="list-item-row">
      <div class="columns is-mobile">
        <div class="column is-10">
          <LinkTo
            @route="vault.cluster.access.identity.show"
            @models={{array "groups" gid "details"}}
            class="is-block has-text-black has-text-weight-semibold"
          >
            <Icon @name="folder" class="has-text-grey-light" />{{gid}}
          </LinkTo>
        </div>
        <div class="column has-text-right">
          {{#if @model.canEdit}}
            <Identity::PopupMembers @model={{@model}} @groupArray="memberGroupIds" @memberId={{gid}} />
          {{/if}}
        </div>
      </div>
    </LinkedBlock>
  {{/each}}
  {{#each @model.memberEntityIds as |gid|}}
    <LinkedBlock @params={{array "vault.cluster.access.identity.show" "groups" gid this.details}} class="list-item-row">
      <div class="columns">
        <div class="column is-10">
          <LinkTo
            @route="vault.cluster.access.identity.show"
            @models={{array "entities" gid "details"}}
            class="is-block has-text-black has-text-weight-semibold"
          >
            <Icon @name="user" class="has-text-grey-light" />{{gid}}
          </LinkTo>
        </div>
        <div class="column has-text-right">
          {{#if @model.canEdit}}
            <Identity::PopupMembers @model={{@model}} @groupArray="memberEntityIds" @memberId={{gid}} />
          {{/if}}
        </div>
      </div>
    </LinkedBlock>
  {{/each}}
{{else}}
  <EmptyState @title="No members in this group yet" />
{{/if}}