<SecretListHeader
  @isCertTab={{eq this.tab "cert"}}
  @model={{this.model}}
  @baseKey={{this.baseKey}}
  @backendCrumb={{this.backendCrumb}}
  @filter={{this.filter}}
/>

{{#if this.showEmptyState}}
  <div class="box is-fullwidth is-shadowless is-sideless is-paddingless is-marginless">
    <Toolbar />
    <EmptyState @title="Connect a database" @message={{this.emptyStateMessage}}>
      {{#if (or this.model.connectionCapabilities.canCreate this.model.connectionCapabilities.canUpdate)}}
        <SecretLink
          @mode="create"
          @secret=""
          @queryParams={{hash initialKey=(or this.filter this.baseKey.id) itemType=this.tab}}
          class="link"
          data-test-secret-create="connections"
        >
          Connect a database
        </SecretLink>
      {{/if}}
    </EmptyState>
  </div>
{{else}}
  <div class="box is-fullwidth is-shadowless has-tall-padding">
    <div class="selectable-card-container {{if (and (eq this.model.connections 403) (eq this.model.roles 403)) 'one-card'}}">
      {{#if this.model.connectionCapabilities.canList}}
        <SelectableCard
          @cardTitle="Connections"
          @total={{if (eq this.model.connections 404) 0 this.model.connections.length}}
          @subText="The total number of connections to external databases that you have access to."
          @actionText="Configure new"
          @actionTo="vault.cluster.secrets.backend.create-root"
          @queryParam={{"connection"}}
          @type="role"
        />
      {{/if}}
      {{#if (or this.model.roleCapabilities.canList this.model.staticRoleCapabilities.canList)}}
        <SelectableCard
          @cardTitle="Roles"
          @total={{if (eq this.model.roles 404) 0 this.model.roles.length}}
          {{! TODO: Messaging needs massaging }}
          @subText="The total number of roles that have been set up that you can list."
          @actionText="Create new"
          @actionTo="vault.cluster.secrets.backend.create-root"
          @queryParam={{"role"}}
        />
      {{/if}}
      <GetCredentialsCard
        @title="Get Credentials"
        @searchLabel="Role to use"
        @backend={{this.model.backend}}
        @models={{array "database/role"}}
        @type="role"
      />
    </div>
  </div>
{{/if}}