package com.airlock.iam.admin.application.service.token.vasco;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public final class VascoOtpAdminSettings {
   private final List<String> availableAdditionalInformation;
   private final boolean emptyAdditionalInformationAllowed;
   private final boolean commentEnabled;
   private final boolean emptyCommentAllowed;
   private final boolean assignmentToMultipleUsersEnabled;
   private final boolean onlyEnabledTokensAssignable;
   private final boolean autoOrderLetter;
   private final boolean allowedAsNextAuthMethod;

   public boolean isCommentMandatory() {
      return this.commentEnabled && !this.emptyCommentAllowed;
   }

   public boolean isAdditionalInformationMandatory() {
      return !this.availableAdditionalInformation.isEmpty() && !this.emptyAdditionalInformationAllowed;
   }

   @SuppressFBWarnings(justification = "generated code")
   VascoOtpAdminSettings(
      List<String> availableAdditionalInformation,
      boolean emptyAdditionalInformationAllowed,
      boolean commentEnabled,
      boolean emptyCommentAllowed,
      boolean assignmentToMultipleUsersEnabled,
      boolean onlyEnabledTokensAssignable,
      boolean autoOrderLetter,
      boolean allowedAsNextAuthMethod
   ) {
      this.availableAdditionalInformation = availableAdditionalInformation;
      this.emptyAdditionalInformationAllowed = emptyAdditionalInformationAllowed;
      this.commentEnabled = commentEnabled;
      this.emptyCommentAllowed = emptyCommentAllowed;
      this.assignmentToMultipleUsersEnabled = assignmentToMultipleUsersEnabled;
      this.onlyEnabledTokensAssignable = onlyEnabledTokensAssignable;
      this.autoOrderLetter = autoOrderLetter;
      this.allowedAsNextAuthMethod = allowedAsNextAuthMethod;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder builder() {
      return new VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder();
   }

   @SuppressFBWarnings(justification = "generated code")
   public List<String> getAvailableAdditionalInformation() {
      return this.availableAdditionalInformation;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isEmptyAdditionalInformationAllowed() {
      return this.emptyAdditionalInformationAllowed;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isCommentEnabled() {
      return this.commentEnabled;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isEmptyCommentAllowed() {
      return this.emptyCommentAllowed;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isAssignmentToMultipleUsersEnabled() {
      return this.assignmentToMultipleUsersEnabled;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isOnlyEnabledTokensAssignable() {
      return this.onlyEnabledTokensAssignable;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isAutoOrderLetter() {
      return this.autoOrderLetter;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isAllowedAsNextAuthMethod() {
      return this.allowedAsNextAuthMethod;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof VascoOtpAdminSettings other)) {
         return false;
      } else {
         if (this.emptyAdditionalInformationAllowed != other.emptyAdditionalInformationAllowed) {
            return false;
         }

         if (this.commentEnabled != other.commentEnabled) {
            return false;
         }

         if (this.emptyCommentAllowed != other.emptyCommentAllowed) {
            return false;
         }

         if (this.assignmentToMultipleUsersEnabled != other.assignmentToMultipleUsersEnabled) {
            return false;
         }

         if (this.onlyEnabledTokensAssignable != other.onlyEnabledTokensAssignable) {
            return false;
         }

         if (this.autoOrderLetter != other.autoOrderLetter) {
            return false;
         }

         if (this.allowedAsNextAuthMethod != other.allowedAsNextAuthMethod) {
            return false;
         }

         Object this$availableAdditionalInformation = this.availableAdditionalInformation;
         Object other$availableAdditionalInformation = other.availableAdditionalInformation;
         return this$availableAdditionalInformation == null
            ? other$availableAdditionalInformation == null
            : this$availableAdditionalInformation.equals(other$availableAdditionalInformation);
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      result = result * 59 + (this.emptyAdditionalInformationAllowed ? 79 : 97);
      result = result * 59 + (this.commentEnabled ? 79 : 97);
      result = result * 59 + (this.emptyCommentAllowed ? 79 : 97);
      result = result * 59 + (this.assignmentToMultipleUsersEnabled ? 79 : 97);
      result = result * 59 + (this.onlyEnabledTokensAssignable ? 79 : 97);
      result = result * 59 + (this.autoOrderLetter ? 79 : 97);
      result = result * 59 + (this.allowedAsNextAuthMethod ? 79 : 97);
      Object $availableAdditionalInformation = this.availableAdditionalInformation;
      return result * 59 + ($availableAdditionalInformation == null ? 43 : $availableAdditionalInformation.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "VascoOtpAdminSettings(availableAdditionalInformation="
         + this.getAvailableAdditionalInformation()
         + ", emptyAdditionalInformationAllowed="
         + this.isEmptyAdditionalInformationAllowed()
         + ", commentEnabled="
         + this.isCommentEnabled()
         + ", emptyCommentAllowed="
         + this.isEmptyCommentAllowed()
         + ", assignmentToMultipleUsersEnabled="
         + this.isAssignmentToMultipleUsersEnabled()
         + ", onlyEnabledTokensAssignable="
         + this.isOnlyEnabledTokensAssignable()
         + ", autoOrderLetter="
         + this.isAutoOrderLetter()
         + ", allowedAsNextAuthMethod="
         + this.isAllowedAsNextAuthMethod()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class VascoOtpAdminSettingsBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<String> availableAdditionalInformation;
      @SuppressFBWarnings(justification = "generated code")
      private boolean emptyAdditionalInformationAllowed;
      @SuppressFBWarnings(justification = "generated code")
      private boolean commentEnabled;
      @SuppressFBWarnings(justification = "generated code")
      private boolean emptyCommentAllowed;
      @SuppressFBWarnings(justification = "generated code")
      private boolean assignmentToMultipleUsersEnabled;
      @SuppressFBWarnings(justification = "generated code")
      private boolean onlyEnabledTokensAssignable;
      @SuppressFBWarnings(justification = "generated code")
      private boolean autoOrderLetter;
      @SuppressFBWarnings(justification = "generated code")
      private boolean allowedAsNextAuthMethod;

      @SuppressFBWarnings(justification = "generated code")
      VascoOtpAdminSettingsBuilder() {
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder availableAdditionalInformationItem(String availableAdditionalInformationItem) {
         if (this.availableAdditionalInformation == null) {
            this.availableAdditionalInformation = new ArrayList<>();
         }

         this.availableAdditionalInformation.add(availableAdditionalInformationItem);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder availableAdditionalInformation(Collection<? extends String> availableAdditionalInformation) {
         if (availableAdditionalInformation == null) {
            throw new NullPointerException("availableAdditionalInformation cannot be null");
         }

         if (this.availableAdditionalInformation == null) {
            this.availableAdditionalInformation = new ArrayList<>();
         }

         this.availableAdditionalInformation.addAll(availableAdditionalInformation);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder clearAvailableAdditionalInformation() {
         if (this.availableAdditionalInformation != null) {
            this.availableAdditionalInformation.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder emptyAdditionalInformationAllowed(boolean emptyAdditionalInformationAllowed) {
         this.emptyAdditionalInformationAllowed = emptyAdditionalInformationAllowed;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder commentEnabled(boolean commentEnabled) {
         this.commentEnabled = commentEnabled;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder emptyCommentAllowed(boolean emptyCommentAllowed) {
         this.emptyCommentAllowed = emptyCommentAllowed;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder assignmentToMultipleUsersEnabled(boolean assignmentToMultipleUsersEnabled) {
         this.assignmentToMultipleUsersEnabled = assignmentToMultipleUsersEnabled;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder onlyEnabledTokensAssignable(boolean onlyEnabledTokensAssignable) {
         this.onlyEnabledTokensAssignable = onlyEnabledTokensAssignable;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder autoOrderLetter(boolean autoOrderLetter) {
         this.autoOrderLetter = autoOrderLetter;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder allowedAsNextAuthMethod(boolean allowedAsNextAuthMethod) {
         this.allowedAsNextAuthMethod = allowedAsNextAuthMethod;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public VascoOtpAdminSettings build() {
         return new VascoOtpAdminSettings(
            switch (this.availableAdditionalInformation == null ? 0 : this.availableAdditionalInformation.size()) {
               case 0 -> Collections.emptyList();
               case 1 -> Collections.singletonList(this.availableAdditionalInformation.get(0));
               default -> Collections.unmodifiableList(new ArrayList<>(this.availableAdditionalInformation));
            },
            this.emptyAdditionalInformationAllowed,
            this.commentEnabled,
            this.emptyCommentAllowed,
            this.assignmentToMultipleUsersEnabled,
            this.onlyEnabledTokensAssignable,
            this.autoOrderLetter,
            this.allowedAsNextAuthMethod
         );
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "VascoOtpAdminSettings.VascoOtpAdminSettingsBuilder(availableAdditionalInformation="
            + this.availableAdditionalInformation
            + ", emptyAdditionalInformationAllowed="
            + this.emptyAdditionalInformationAllowed
            + ", commentEnabled="
            + this.commentEnabled
            + ", emptyCommentAllowed="
            + this.emptyCommentAllowed
            + ", assignmentToMultipleUsersEnabled="
            + this.assignmentToMultipleUsersEnabled
            + ", onlyEnabledTokensAssignable="
            + this.onlyEnabledTokensAssignable
            + ", autoOrderLetter="
            + this.autoOrderLetter
            + ", allowedAsNextAuthMethod="
            + this.allowedAsNextAuthMethod
            + ")";
      }
   }
}
