<SecretListHeader
  @model={{this.model.parentModel}}
  @backendCrumb={{hash
    label=this.model.parentModel.id
    text=this.model.parentModel.id
    path="vault.cluster.secrets.backend.list-root"
    model=this.model.parentModel.id
  }}
  @isEngine={{true}}
/>

<PkiPaginatedList @listRoute="certificates.index" @list={{this.model.certificates}} @hasConfig={{this.model.hasConfig}}>
  <:list as |certs|>
    {{#each certs as |pkiCertificate|}}
      <LinkedBlock
        class="list-item-row"
        @params={{array "certificates.certificate.details" pkiCertificate.id}}
        @linkPrefix={{this.mountPoint}}
      >
        <div class="level is-mobile">
          <div class="level-left">
            <div>
              <Icon @name="certificate" class="has-text-grey-light" />
              <span class="has-text-weight-semibold is-underline">
                {{pkiCertificate.id}}
              </span>
              <div class="is-flex-row has-left-margin-l has-top-margin-xs">
              </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="certificates.certificate.details" @model={{pkiCertificate.id}}>
                        Details
                      </LinkTo>
                    </li>
                    {{! ARG TODO ask Ivana if we wnat revoke or maybe download action here? }}
                  </ul>
                </nav>
              </PopupMenu>
            </div>
          </div>
        </div>
      </LinkedBlock>
    {{/each}}
  </:list>
  <:empty>
    <EmptyState @title="No certificates yet">
      <div>
        <p>When created, certificates will be listed here. Select a role to start generating certificates.</p>
        <div class="has-top-margin-m">
          <LinkTo @route="roles.index">
            View roles
          </LinkTo>
        </div>
      </div>
    </EmptyState>
  </:empty>
  <:configure>
    <EmptyState @title="PKI not configured" @message={{this.notConfiguredMessage}}>
      <LinkTo @route="configuration.create">
        Configure PKI
      </LinkTo>
    </EmptyState>
  </:configure>
</PkiPaginatedList>