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

<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-field>
    <bit-label>{{ "overridePasswordTypePolicy" | i18n }}</bit-label>
    <bit-select formControlName="overridePasswordType" id="overrideType">
      @for (o of overridePasswordTypeOptions; track o.value) {
        <bit-option [value]="o.value" [label]="o.name"></bit-option>
      }
    </bit-select>
  </bit-form-field>

  @if (showPasswordPolicies$ | async) {
    <h3 bitTypography="h3" class="tw-mt-4">{{ "generatedPassword" | i18n }}</h3>

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

    <bit-form-field>
      <bit-label>{{ "minNumbers" | i18n }}</bit-label>
      <input
        bitInput
        type="number"
        [min]="minNumbersMin"
        [max]="minNumbersMax"
        formControlName="minNumbers"
      />
    </bit-form-field>

    <bit-form-field>
      <bit-label>{{ "minSpecialCharacters" | i18n }}</bit-label>
      <input
        bitInput
        type="number"
        [min]="minSpecialMin"
        [max]="minSpecialMax"
        formControlName="minSpecial"
      />
    </bit-form-field>

    <bit-form-control-group>
      <bit-label>{{ "characterRequirements" | i18n }}</bit-label>
      <bit-form-control disableMargin>
        <input type="checkbox" bitCheckbox formControlName="useUpper" id="useUpper" />
        <bit-label>{{ "uppercasePolicy" | i18n }}</bit-label>
      </bit-form-control>
      <bit-form-control disableMargin>
        <input type="checkbox" bitCheckbox formControlName="useLower" id="useLower" />
        <bit-label>{{ "lowercasePolicy" | i18n }}</bit-label>
      </bit-form-control>
      <bit-form-control disableMargin>
        <input type="checkbox" bitCheckbox formControlName="useNumbers" id="useNumbers" />
        <bit-label>{{ "numbersPolicy" | i18n }}</bit-label>
      </bit-form-control>
      <bit-form-control disableMargin>
        <input type="checkbox" bitCheckbox formControlName="useSpecial" id="useSpecial" />
        <bit-label>{{ "specialCharactersPolicy" | i18n }}</bit-label>
      </bit-form-control>
    </bit-form-control-group>
  }

  @if (showPassphrasePolicies$ | async) {
    <h3 bitTypography="h3" class="tw-mt-4">{{ "generatedPassphrase" | i18n }}</h3>

    <bit-form-field>
      <bit-label>{{ "minimumNumberOfWords" | i18n }}</bit-label>
      <input
        bitInput
        type="number"
        [min]="minNumberWordsMin"
        [max]="minNumberWordsMax"
        formControlName="minNumberWords"
      />
    </bit-form-field>

    <bit-form-control-group>
      <bit-label>{{ "characterRequirements" | i18n }}</bit-label>
      <bit-form-control disableMargin>
        <input type="checkbox" bitCheckbox formControlName="capitalize" id="capitalize" />
        <bit-label>{{ "uppercasePolicy" | i18n }}</bit-label>
      </bit-form-control>
      <bit-form-control disableMargin>
        <input type="checkbox" bitCheckbox formControlName="includeNumber" id="includeNumber" />
        <bit-label>{{ "numbersPolicy" | i18n }}</bit-label>
      </bit-form-control>
    </bit-form-control-group>
  }
</div>
