package com.airlock.iam.common.api.domain.model.otp;

import com.google.common.base.CharMatcher;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang3.Validate;

public final class UnverifiedOtp {
   private final String value;

   private UnverifiedOtp(String value) {
      Validate.notBlank(value);
      this.value = value;
   }

   public static UnverifiedOtp unverifiedOtp(String value) {
      return new UnverifiedOtp(value);
   }

   public String rawValue() {
      return this.value;
   }

   public String normalized() {
      return CharMatcher.whitespace().removeFrom(this.value);
   }

   @Override
   public String toString() {
      return "Unverified OTP(value=***)";
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof UnverifiedOtp other)) {
         return false;
      } else {
         Object this$value = this.value;
         Object other$value = other.value;
         return this$value == null ? other$value == null : this$value.equals(other$value);
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      Object $value = this.value;
      return result * 59 + ($value == null ? 43 : $value.hashCode());
   }
}
