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

<section class="section access-control-overview">
  <section class="intro">
    <p>Your Nomad cluster has Access Control enabled, which you can use to control access to data and APIs. Here, you can manage the Tokens, Policies, and Roles for your system.</p>
    <footer>
      <Hds::Link::Standalone @icon="docs-link" @text="ACL System Fundamentals" @iconPosition="trailing" @href="https://developer.hashicorp.com/nomad/tutorials/access-control/access-control" />
      <Hds::Link::Standalone @icon="docs-link" @text="ACL Policy Concepts" @iconPosition="trailing" @href="https://developer.hashicorp.com/nomad/tutorials/access-control/access-control-policies" />
    </footer>
  </section>
  <div class="section-cards">
    <Hds::Card::Container @level="mid" @hasBorder={{true}} data-test-tokens-card>
        <LinkTo
          @route="administration.tokens"
        >
          {{this.model.tokens.length}} {{pluralize "Token" this.model.tokens.length}}
        </LinkTo>
        <p>User access tokens are associated with one or more policies or roles to grant specific capabilities.</p>
        <Hds::Button @text="Create Token" @color="secondary" @iconPosition="leading" @icon="plus" @route="administration.tokens.new" />
    </Hds::Card::Container>
    <Hds::Card::Container @level="mid" @hasBorder={{true}} data-test-roles-card>
      <LinkTo
        @route="administration.roles"
      >
        {{this.model.roles.length}} {{pluralize "Role" this.model.roles.length}}
      </LinkTo>
      <p>Roles group one or more Policies into higher-level sets of permissions.</p>
      <Hds::Button @text="Create Role" @color="secondary" @iconPosition="leading" @icon="plus" @route="administration.roles.new" />
    </Hds::Card::Container>
    <Hds::Card::Container @level="mid" @hasBorder={{true}} data-test-policies-card>
      <LinkTo
        @route="administration.policies"
      >
        {{this.model.policies.length}} {{pluralize "Policy" this.model.policies.length}}
      </LinkTo>
      <p>Sets of rules defining the capabilities granted to adhering tokens.</p>
      <Hds::Button @text="Create Policy" @color="secondary" @iconPosition="leading" @icon="plus" @route="administration.policies.new" />
    </Hds::Card::Container>
    <Hds::Card::Container @level="mid" @hasBorder={{true}} data-test-namespaces-card>
      <LinkTo
        @route="administration.namespaces"
      >
        {{this.model.namespaces.length}} {{pluralize "Namespace" this.model.namespaces.length}}
      </LinkTo>
      <p>Namespaces allow jobs and other objects to be segmented from each other.</p>
      <Hds::Button @text="Create Namespace" @color="secondary" @iconPosition="leading" @icon="plus" @route="administration.namespaces.new" />
    </Hds::Card::Container>
    {{#if (can "read sentinel-policy")}}
      <Hds::Card::Container @level="mid" @hasBorder={{true}} data-test-sentinel-policies-card>
        <LinkTo
          @route="administration.sentinel-policies"
        >
          {{this.model.sentinelPolicies.length}} {{pluralize "Sentinel Policy" this.model.sentinelPolicies.length}}
        </LinkTo>
        <p>Sentinel Policies allow operators to express rules as code and have those rules automatically enforced when jobs are planned.</p>
        <Hds::Button @text="Create Sentinel Policy" @color="secondary" @iconPosition="leading" @icon="plus" @route="administration.sentinel-policies.new" />
      </Hds::Card::Container>
    {{/if}}
  </div>
</section>
{{outlet}}
