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

{{#each @model as |provider|}}
  <LinkedBlock
    class="list-item-row"
    @params={{array "vault.cluster.access.oidc.providers.provider.details" provider.name}}
    data-test-oidc-provider-linked-block={{provider.name}}
  >
    <div class="level is-mobile">
      <div class="level-left">
        <div>
          <Icon @name="provider" class="has-text-grey-light" />
          <span class="has-text-weight-semibold is-underline">
            {{provider.name}}
          </span>
          <div class="has-text-grey is-size-8">
            Issuer:
            {{provider.issuer}}
          </div>
        </div>
      </div>
      <div class="level-right is-flex is-paddingless is-marginless">
        <div class="level-item">
          <PopupMenu>
            <nav class="menu">
              <ul class="menu-list">
                <li>
                  <LinkTo
                    @route="vault.cluster.access.oidc.providers.provider.details"
                    @model={{provider.name}}
                    @disabled={{eq provider.canRead false}}
                    data-test-oidc-provider-menu-link="details"
                  >
                    Details
                  </LinkTo>
                </li>
                <li>
                  <LinkTo
                    @route="vault.cluster.access.oidc.providers.provider.edit"
                    @model={{provider.name}}
                    @disabled={{not provider.canEdit}}
                    data-test-oidc-provider-menu-link="edit"
                  >
                    Edit
                  </LinkTo>
                </li>
              </ul>
            </nav>
          </PopupMenu>
        </div>
      </div>
    </div>
  </LinkedBlock>
{{/each}}