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

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;

public final class AccountInfo {
   private final String info;

   public static AccountInfo accountInfo(Object value) {
      if (value == null) {
         return emptyAccountInfo();
      }

      String stringValue = String.valueOf(value);
      return !StringUtils.isBlank(stringValue) && !Strings.CI.equals(stringValue, "null") ? new AccountInfo(stringValue) : emptyAccountInfo();
   }

   public static AccountInfo emptyAccountInfo() {
      return new AccountInfo(null);
   }

   @SuppressFBWarnings(justification = "generated code")
   public AccountInfo(String info) {
      this.info = info;
   }

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

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

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

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