<p>{{ "masterPassPolicyDesc" | i18n }}</p>

@if (showKeyConnectorInfo$ | async) {
  <bit-callout type="info">
    {{ "keyConnectorPolicyRestriction" | i18n }}
  </bit-callout>
}

<div [formGroup]="data">
  <bit-form-control>
    <bit-switch [formControl]="enabled" id="enabled"></bit-switch>
    <bit-label>{{ "enablePolicy" | i18n }}</bit-label>
  </bit-form-control>

  <bit-form-control>
    <input type="checkbox" bitCheckbox formControlName="enforceOnLogin" id="enforceOnLogin" />
    <bit-label>{{ "enforceOnLoginDesc" | i18n }}</bit-label>
  </bit-form-control>

  <bit-form-field>
    <bit-label>{{ "minComplexityScore" | i18n }}</bit-label>
    <bit-select formControlName="minComplexity" id="minComplexity">
      @for (o of passwordScores; track o.value) {
        <bit-option [value]="o.value" [label]="o.name"></bit-option>
      }
    </bit-select>
  </bit-form-field>

  <bit-form-field>
    <bit-label>{{ "minCharacterLength" | i18n }}</bit-label>
    <input
      bitInput
      type="number"
      formControlName="minLength"
      id="minLength"
      [min]="MinPasswordLength"
      [max]="MaxPasswordLength"
    />
  </bit-form-field>

  <p bitTypography="body2" class="tw-mb-1 tw-text-muted">{{ "characterRequirements" | i18n }}</p>

  <bit-form-control class="!tw-mb-2">
    <input type="checkbox" bitCheckbox formControlName="requireUpper" id="requireUpper" />
    <bit-label>{{ "uppercasePolicy" | i18n }}</bit-label>
  </bit-form-control>
  <bit-form-control class="!tw-mb-2">
    <input type="checkbox" bitCheckbox formControlName="requireLower" id="requireLower" />
    <bit-label>{{ "lowercasePolicy" | i18n }}</bit-label>
  </bit-form-control>
  <bit-form-control class="!tw-mb-2">
    <input type="checkbox" bitCheckbox formControlName="requireNumbers" id="requireNumbers" />
    <bit-label>{{ "numbersPolicy" | i18n }}</bit-label>
  </bit-form-control>
  <bit-form-control>
    <input type="checkbox" bitCheckbox formControlName="requireSpecial" id="requireSpecial" />
    <bit-label>{{ "specialCharactersPolicy" | i18n }}</bit-label>
  </bit-form-control>
</div>
