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

<Clients::RunningTotal @byMonthClients={{this.byMonthClients}} @runningTotals={{@activity.total}} />

{{! by_namespace is an empty array when there is no client count activity data }}
{{#if @activity.byNamespace}}
  <Clients::CountsCard @title="Client attribution">
    <:subheader>
      <Clients::FilterToolbar
        @dataset={{this.activityData}}
        @onFilter={{this.handleFilter}}
        @filterQueryParams={{@filterQueryParams}}
        @dropdownMonths={{this.months}}
      />
    </:subheader>

    <:table>
      <Clients::Table
        data-test-table="attribution"
        @data={{this.tableData}}
        @columns={{this.tableColumns}}
        @initiallySortBy={{hash column="clients" direction="desc"}}
        @setPageSize={{10}}
        @showPaginationSizeSelector={{true}}
      >
        <:emptyState>
          <Hds::ApplicationState as |A|>
            <A.Header @title="No data found" />
            <A.Body @text="Clear or change filters to view client count data." />
            <A.Footer as |F|>
              <F.LinkStandalone
                @icon="file-text"
                @text="Client count documentation"
                @href="https://developer.hashicorp.com/vault/docs/concepts/client-count"
                @iconPosition="trailing"
              />
            </A.Footer>
          </Hds::ApplicationState>
        </:emptyState>
      </Clients::Table>
    </:table>
  </Clients::CountsCard>
{{/if}}