package com.airlock.iam.common.domain.model.phone;

import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public final class VisiblePhoneNumberDigits {
   private final int count;

   public static VisiblePhoneNumberDigits of(int count) {
      return new VisiblePhoneNumberDigits(count);
   }

   private VisiblePhoneNumberDigits(int count) {
      Preconditions.checkArgument(count >= 0, "count must not be negative");
      this.count = count;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      return result * 59 + this.count;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "VisiblePhoneNumberDigits(count=" + this.getCount() + ")";
   }
}
