package com.airlock.iam.flow.shared.domain.model.user;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Date;
import java.util.Optional;

public final class UserLoginStatistics {
   private final Date latestSuccessfulLogin;
   private final Date secondLatestSuccessfulLogin;
   private final Date firstLogin;
   private final Date latestLoginAttempt;
   private final int totalLogins;
   private final int failedLogins;
   private final int failedLoginsBeforeLatestSuccessfulLogin;
   private final Date selfRegistrationDate;
   private final Date latestUnlockAttempt;
   private final int unlockAttempts;
   private final Date lockDate;
   private final String lockReason;
   private final boolean selfRegistered;
   private final boolean locked;
   private final boolean valid;
   private final Date validFrom;
   private final Date validTo;

   public Optional<Date> getLatestSuccessfulLogin() {
      return Optional.ofNullable(this.latestSuccessfulLogin);
   }

   public Optional<Date> getSecondLatestSuccessfulLogin() {
      return Optional.ofNullable(this.secondLatestSuccessfulLogin);
   }

   public Optional<Date> getFirstLogin() {
      return Optional.ofNullable(this.firstLogin);
   }

   public Optional<Date> getLatestLoginAttempt() {
      return Optional.ofNullable(this.latestLoginAttempt);
   }

   public Optional<Date> getSelfRegistrationDate() {
      return Optional.ofNullable(this.selfRegistrationDate);
   }

   public Optional<Date> getLockDate() {
      return Optional.ofNullable(this.lockDate);
   }

   public Optional<Date> getLatestUnlockAttempt() {
      return Optional.ofNullable(this.latestUnlockAttempt);
   }

   public Optional<String> getLockReason() {
      return Optional.ofNullable(this.lockReason);
   }

   public Optional<Date> getValidFrom() {
      return Optional.ofNullable(this.validFrom);
   }

   public Optional<Date> getValidTo() {
      return Optional.ofNullable(this.validTo);
   }

   @SuppressFBWarnings(justification = "generated code")
   UserLoginStatistics(
      Date latestSuccessfulLogin,
      Date secondLatestSuccessfulLogin,
      Date firstLogin,
      Date latestLoginAttempt,
      int totalLogins,
      int failedLogins,
      int failedLoginsBeforeLatestSuccessfulLogin,
      Date selfRegistrationDate,
      Date latestUnlockAttempt,
      int unlockAttempts,
      Date lockDate,
      String lockReason,
      boolean selfRegistered,
      boolean locked,
      boolean valid,
      Date validFrom,
      Date validTo
   ) {
      this.latestSuccessfulLogin = latestSuccessfulLogin;
      this.secondLatestSuccessfulLogin = secondLatestSuccessfulLogin;
      this.firstLogin = firstLogin;
      this.latestLoginAttempt = latestLoginAttempt;
      this.totalLogins = totalLogins;
      this.failedLogins = failedLogins;
      this.failedLoginsBeforeLatestSuccessfulLogin = failedLoginsBeforeLatestSuccessfulLogin;
      this.selfRegistrationDate = selfRegistrationDate;
      this.latestUnlockAttempt = latestUnlockAttempt;
      this.unlockAttempts = unlockAttempts;
      this.lockDate = lockDate;
      this.lockReason = lockReason;
      this.selfRegistered = selfRegistered;
      this.locked = locked;
      this.valid = valid;
      this.validFrom = validFrom;
      this.validTo = validTo;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public int getTotalLogins() {
      return this.totalLogins;
   }

   @SuppressFBWarnings(justification = "generated code")
   public int getFailedLogins() {
      return this.failedLogins;
   }

   @SuppressFBWarnings(justification = "generated code")
   public int getFailedLoginsBeforeLatestSuccessfulLogin() {
      return this.failedLoginsBeforeLatestSuccessfulLogin;
   }

   @SuppressFBWarnings(justification = "generated code")
   public int getUnlockAttempts() {
      return this.unlockAttempts;
   }

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

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

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

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

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

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

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

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

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

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

         Object this$latestSuccessfulLogin = this.latestSuccessfulLogin;
         Object other$latestSuccessfulLogin = other.latestSuccessfulLogin;
         if (this$latestSuccessfulLogin == null ? other$latestSuccessfulLogin == null : this$latestSuccessfulLogin.equals(other$latestSuccessfulLogin)) {
            Object this$secondLatestSuccessfulLogin = this.secondLatestSuccessfulLogin;
            Object other$secondLatestSuccessfulLogin = other.secondLatestSuccessfulLogin;
            if (this$secondLatestSuccessfulLogin == null
               ? other$secondLatestSuccessfulLogin == null
               : this$secondLatestSuccessfulLogin.equals(other$secondLatestSuccessfulLogin)) {
               Object this$firstLogin = this.firstLogin;
               Object other$firstLogin = other.firstLogin;
               if (this$firstLogin == null ? other$firstLogin == null : this$firstLogin.equals(other$firstLogin)) {
                  Object this$latestLoginAttempt = this.latestLoginAttempt;
                  Object other$latestLoginAttempt = other.latestLoginAttempt;
                  if (this$latestLoginAttempt == null ? other$latestLoginAttempt == null : this$latestLoginAttempt.equals(other$latestLoginAttempt)) {
                     Object this$selfRegistrationDate = this.selfRegistrationDate;
                     Object other$selfRegistrationDate = other.selfRegistrationDate;
                     if (this$selfRegistrationDate == null ? other$selfRegistrationDate == null : this$selfRegistrationDate.equals(other$selfRegistrationDate)) {
                        Object this$latestUnlockAttempt = this.latestUnlockAttempt;
                        Object other$latestUnlockAttempt = other.latestUnlockAttempt;
                        if (this$latestUnlockAttempt == null ? other$latestUnlockAttempt == null : this$latestUnlockAttempt.equals(other$latestUnlockAttempt)) {
                           Object this$lockDate = this.lockDate;
                           Object other$lockDate = other.lockDate;
                           if (this$lockDate == null ? other$lockDate == null : this$lockDate.equals(other$lockDate)) {
                              Object this$lockReason = this.lockReason;
                              Object other$lockReason = other.lockReason;
                              if (this$lockReason == null ? other$lockReason == null : this$lockReason.equals(other$lockReason)) {
                                 Object this$validFrom = this.validFrom;
                                 Object other$validFrom = other.validFrom;
                                 if (this$validFrom == null ? other$validFrom == null : this$validFrom.equals(other$validFrom)) {
                                    Object this$validTo = this.validTo;
                                    Object other$validTo = other.validTo;
                                    return this$validTo == null ? other$validTo == null : this$validTo.equals(other$validTo);
                                 } else {
                                    return false;
                                 }
                              } else {
                                 return false;
                              }
                           } else {
                              return false;
                           }
                        } else {
                           return false;
                        }
                     } else {
                        return false;
                     }
                  } else {
                     return false;
                  }
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      result = result * 59 + this.totalLogins;
      result = result * 59 + this.failedLogins;
      result = result * 59 + this.failedLoginsBeforeLatestSuccessfulLogin;
      result = result * 59 + this.unlockAttempts;
      result = result * 59 + (this.selfRegistered ? 79 : 97);
      result = result * 59 + (this.locked ? 79 : 97);
      result = result * 59 + (this.valid ? 79 : 97);
      Object $latestSuccessfulLogin = this.latestSuccessfulLogin;
      result = result * 59 + ($latestSuccessfulLogin == null ? 43 : $latestSuccessfulLogin.hashCode());
      Object $secondLatestSuccessfulLogin = this.secondLatestSuccessfulLogin;
      result = result * 59 + ($secondLatestSuccessfulLogin == null ? 43 : $secondLatestSuccessfulLogin.hashCode());
      Object $firstLogin = this.firstLogin;
      result = result * 59 + ($firstLogin == null ? 43 : $firstLogin.hashCode());
      Object $latestLoginAttempt = this.latestLoginAttempt;
      result = result * 59 + ($latestLoginAttempt == null ? 43 : $latestLoginAttempt.hashCode());
      Object $selfRegistrationDate = this.selfRegistrationDate;
      result = result * 59 + ($selfRegistrationDate == null ? 43 : $selfRegistrationDate.hashCode());
      Object $latestUnlockAttempt = this.latestUnlockAttempt;
      result = result * 59 + ($latestUnlockAttempt == null ? 43 : $latestUnlockAttempt.hashCode());
      Object $lockDate = this.lockDate;
      result = result * 59 + ($lockDate == null ? 43 : $lockDate.hashCode());
      Object $lockReason = this.lockReason;
      result = result * 59 + ($lockReason == null ? 43 : $lockReason.hashCode());
      Object $validFrom = this.validFrom;
      result = result * 59 + ($validFrom == null ? 43 : $validFrom.hashCode());
      Object $validTo = this.validTo;
      return result * 59 + ($validTo == null ? 43 : $validTo.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "UserLoginStatistics(latestSuccessfulLogin="
         + this.getLatestSuccessfulLogin()
         + ", secondLatestSuccessfulLogin="
         + this.getSecondLatestSuccessfulLogin()
         + ", firstLogin="
         + this.getFirstLogin()
         + ", latestLoginAttempt="
         + this.getLatestLoginAttempt()
         + ", totalLogins="
         + this.getTotalLogins()
         + ", failedLogins="
         + this.getFailedLogins()
         + ", failedLoginsBeforeLatestSuccessfulLogin="
         + this.getFailedLoginsBeforeLatestSuccessfulLogin()
         + ", selfRegistrationDate="
         + this.getSelfRegistrationDate()
         + ", latestUnlockAttempt="
         + this.getLatestUnlockAttempt()
         + ", unlockAttempts="
         + this.getUnlockAttempts()
         + ", lockDate="
         + this.getLockDate()
         + ", lockReason="
         + this.getLockReason()
         + ", selfRegistered="
         + this.isSelfRegistered()
         + ", locked="
         + this.isLocked()
         + ", valid="
         + this.isValid()
         + ", validFrom="
         + this.getValidFrom()
         + ", validTo="
         + this.getValidTo()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class UserLoginStatisticsBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private Date latestSuccessfulLogin;
      @SuppressFBWarnings(justification = "generated code")
      private Date secondLatestSuccessfulLogin;
      @SuppressFBWarnings(justification = "generated code")
      private Date firstLogin;
      @SuppressFBWarnings(justification = "generated code")
      private Date latestLoginAttempt;
      @SuppressFBWarnings(justification = "generated code")
      private int totalLogins;
      @SuppressFBWarnings(justification = "generated code")
      private int failedLogins;
      @SuppressFBWarnings(justification = "generated code")
      private int failedLoginsBeforeLatestSuccessfulLogin;
      @SuppressFBWarnings(justification = "generated code")
      private Date selfRegistrationDate;
      @SuppressFBWarnings(justification = "generated code")
      private Date latestUnlockAttempt;
      @SuppressFBWarnings(justification = "generated code")
      private int unlockAttempts;
      @SuppressFBWarnings(justification = "generated code")
      private Date lockDate;
      @SuppressFBWarnings(justification = "generated code")
      private String lockReason;
      @SuppressFBWarnings(justification = "generated code")
      private boolean selfRegistered;
      @SuppressFBWarnings(justification = "generated code")
      private boolean locked;
      @SuppressFBWarnings(justification = "generated code")
      private boolean valid;
      @SuppressFBWarnings(justification = "generated code")
      private Date validFrom;
      @SuppressFBWarnings(justification = "generated code")
      private Date validTo;

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

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder latestSuccessfulLogin(Date latestSuccessfulLogin) {
         this.latestSuccessfulLogin = latestSuccessfulLogin;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder secondLatestSuccessfulLogin(Date secondLatestSuccessfulLogin) {
         this.secondLatestSuccessfulLogin = secondLatestSuccessfulLogin;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder firstLogin(Date firstLogin) {
         this.firstLogin = firstLogin;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder latestLoginAttempt(Date latestLoginAttempt) {
         this.latestLoginAttempt = latestLoginAttempt;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder totalLogins(int totalLogins) {
         this.totalLogins = totalLogins;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder failedLogins(int failedLogins) {
         this.failedLogins = failedLogins;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder failedLoginsBeforeLatestSuccessfulLogin(int failedLoginsBeforeLatestSuccessfulLogin) {
         this.failedLoginsBeforeLatestSuccessfulLogin = failedLoginsBeforeLatestSuccessfulLogin;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder selfRegistrationDate(Date selfRegistrationDate) {
         this.selfRegistrationDate = selfRegistrationDate;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder latestUnlockAttempt(Date latestUnlockAttempt) {
         this.latestUnlockAttempt = latestUnlockAttempt;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder unlockAttempts(int unlockAttempts) {
         this.unlockAttempts = unlockAttempts;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder lockDate(Date lockDate) {
         this.lockDate = lockDate;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder lockReason(String lockReason) {
         this.lockReason = lockReason;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder selfRegistered(boolean selfRegistered) {
         this.selfRegistered = selfRegistered;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder locked(boolean locked) {
         this.locked = locked;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder valid(boolean valid) {
         this.valid = valid;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder validFrom(Date validFrom) {
         this.validFrom = validFrom;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics.UserLoginStatisticsBuilder validTo(Date validTo) {
         this.validTo = validTo;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public UserLoginStatistics build() {
         return new UserLoginStatistics(
            this.latestSuccessfulLogin,
            this.secondLatestSuccessfulLogin,
            this.firstLogin,
            this.latestLoginAttempt,
            this.totalLogins,
            this.failedLogins,
            this.failedLoginsBeforeLatestSuccessfulLogin,
            this.selfRegistrationDate,
            this.latestUnlockAttempt,
            this.unlockAttempts,
            this.lockDate,
            this.lockReason,
            this.selfRegistered,
            this.locked,
            this.valid,
            this.validFrom,
            this.validTo
         );
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "UserLoginStatistics.UserLoginStatisticsBuilder(latestSuccessfulLogin="
            + this.latestSuccessfulLogin
            + ", secondLatestSuccessfulLogin="
            + this.secondLatestSuccessfulLogin
            + ", firstLogin="
            + this.firstLogin
            + ", latestLoginAttempt="
            + this.latestLoginAttempt
            + ", totalLogins="
            + this.totalLogins
            + ", failedLogins="
            + this.failedLogins
            + ", failedLoginsBeforeLatestSuccessfulLogin="
            + this.failedLoginsBeforeLatestSuccessfulLogin
            + ", selfRegistrationDate="
            + this.selfRegistrationDate
            + ", latestUnlockAttempt="
            + this.latestUnlockAttempt
            + ", unlockAttempts="
            + this.unlockAttempts
            + ", lockDate="
            + this.lockDate
            + ", lockReason="
            + this.lockReason
            + ", selfRegistered="
            + this.selfRegistered
            + ", locked="
            + this.locked
            + ", valid="
            + this.valid
            + ", validFrom="
            + this.validFrom
            + ", validTo="
            + this.validTo
            + ")";
      }
   }
}
