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

{{#if (and this.licenseExpired (not this.expiredDismissed))}}
  <Hds::Alert
    @type="inline"
    @color="critical"
    @onDismiss={{fn this.dismissBanner "expired"}}
    data-test-license-banner-expired
    as |A|
  >
    <A.Title>License expired</A.Title>
    <A.Description>
      Your Vault license expired on
      {{date-format @expiry "MMM d, yyyy"}}. Add a new license to your configuration and restart Vault.
    </A.Description>
    <A.Description class="has-top-margin-xs">
      <DocLink @path="/vault/tutorials/enterprise/hashicorp-enterprise-license">
        Read documentation
        <Icon @name="learn-link" />
      </DocLink>
    </A.Description>
  </Hds::Alert>
{{else if (and (lte this.licenseExpiringInDays 30) (not this.warningDismissed))}}
  <Hds::Alert
    @type="inline"
    @color="warning"
    @onDismiss={{fn this.dismissBanner "warning"}}
    data-test-license-banner-warning
    as |A|
  >
    <A.Title>Vault license expiring</A.Title>
    <A.Description>
      Your Vault license will expire in
      {{this.licenseExpiringInDays}}
      days at
      {{date-format @expiry "hh:mm:ss a"}}
      on
      {{date-format @expiry "MMM d, yyyy"}}.
      {{if
        @autoloaded
        "Add a new license to your configuration."
        "Keep in mind that your next license will need to be autoloaded."
      }}
    </A.Description>
    <A.Description class="has-top-margin-xs">
      <DocLink @path="/vault/tutorials/enterprise/hashicorp-enterprise-license">
        Read documentation
        <Icon @name="learn-link" />
      </DocLink>
    </A.Description>
  </Hds::Alert>
{{/if}}