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

<Toolbar>
  <ToolbarActions>
    <ToolbarLink @route="vault.cluster.access.oidc.scopes.create" @type="add" data-test-oidc-scope-create>
      Create scope
    </ToolbarLink>
  </ToolbarActions>
</Toolbar>

{{#if (gt this.model.length 0)}}
  {{#each this.model as |model|}}
    <LinkedBlock
      class="list-item-row"
      @params={{array "vault.cluster.access.oidc.scopes.scope.details" model.name}}
      data-test-oidc-scope-linked-block={{model.name}}
    >
      <div class="level is-mobile">
        <div class="level-left">
          <div>
            <Icon @name="file" class="has-text-grey-light" />
            <span class="has-text-weight-semibold is-underline">
              {{model.name}}
            </span>
          </div>
        </div>
        <div class="level-right is-flex is-paddingless is-marginless">
          <div class="level-item">
            <Hds::Dropdown @isInline={{true}} @listPosition="bottom-right" as |dd|>
              <dd.ToggleIcon
                @icon="more-horizontal"
                @text="Assignment nav options"
                @hasChevron={{false}}
                data-test-popup-menu-trigger
              />
              <dd.Interactive
                @text="Details"
                @route="vault.cluster.access.oidc.scopes.scope.details"
                @model={{model.name}}
                @disabled={{eq model.canRead false}}
                data-test-oidc-scope-menu-link="details"
              />
              <dd.Interactive
                @text="Edit"
                @route="vault.cluster.access.oidc.scopes.scope.edit"
                @model={{model.name}}
                @disabled={{eq model.canEdit false}}
                data-test-oidc-scope-menu-link="edit"
              />
            </Hds::Dropdown>
          </div>
        </div>
      </div>
    </LinkedBlock>
  {{/each}}
{{else}}
  <EmptyState
    @title="No scopes yet"
    @message="Use scope to define identity information about the authenticated user."
    data-test-oidc-scope-empty-state
  >
    <Hds::Link::Standalone
      @iconPosition="trailing"
      @icon="docs-link"
      @text="OIDC provider scopes"
      @href={{doc-link "/vault/docs/concepts/oidc-provider#scopes"}}
    />
  </EmptyState>
{{/if}}