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

{{#if (and @item.updatePath.canRead (not this.isBuiltin))}}
  <LinkedBlock
    @params={{array "vault.cluster.secrets.backend.show" @itemPath}}
    class="list-item-row"
    data-test-secret-link={{@itemPath}}
    @encode={{true}}
    @queryParams={{secret-query-params @backendType}}
  >
    <div class="columns is-mobile">
      <div class="column is-10">
        <SecretLink
          @mode="show"
          @secret={{@itemPath}}
          @queryParams={{hash type=@modelType}}
          class="has-text-black has-text-weight-semibold"
        >
          <Icon @name="file" class="has-text-grey-light" />
          {{if (eq @item.id " ") "(self)" (or @item.keyWithoutParent @item.id)}}
        </SecretLink>
      </div>
      <div class="column has-text-right">
        {{#if (or @item.updatePath.canRead @item.updatePath.canUpdate)}}
          <Hds::Dropdown @isInline={{true}} @listPosition="bottom-right" as |dd|>
            <dd.ToggleIcon
              @icon="more-horizontal"
              @text="Manage transform {{@itemType}}"
              @hasChevron={{false}}
              data-test-popup-menu-trigger
            />
            {{#if @item.updatePath.canRead}}
              <dd.Interactive @route="vault.cluster.secrets.backend.show" @model={{@itemPath}}>Details</dd.Interactive>
            {{/if}}
            {{#if @item.updatePath.canUpdate}}
              <dd.Interactive @route="vault.cluster.secrets.backend.edit" @model={{@itemPath}}>Edit</dd.Interactive>
            {{/if}}
          </Hds::Dropdown>
        {{/if}}
      </div>
    </div>
  </LinkedBlock>
{{else}}
  <div class="list-item-row" data-test-view-only-list-item>
    <div class="columns is-mobile">
      <div class="column is-12 has-text-grey has-text-weight-semibold">
        <Icon @name="file" class="has-text-grey-light" />
        {{#if this.isBuiltin}}
          <Hds::TooltipButton
            @text="This is a built-in HashiCorp {{@itemType}}. It can't be viewed or edited."
            @placement="top-start"
            aria-label="Why this item cannot be viewed or edited"
          >
            {{@item.id}}
          </Hds::TooltipButton>
        {{else}}
          {{@item.id}}
        {{/if}}
      </div>
    </div>
  </div>
{{/if}}