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

import com.google.common.base.MoreObjects;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.time.LocalDateTime;
import java.util.Optional;

public final class AccountLinkData {
   private final int id;
   private final String username;
   private final String providerId;
   private final String accountSub;
   private final Optional<String> accountInfo;
   private final LocalDateTime establishedAt;

   public static AccountLinkData accountLinkData(int id, String username, String providerId, String accountSub, String accountInfo, LocalDateTime establishedAt) {
      return new AccountLinkData(id, username, providerId, accountSub, Optional.ofNullable(accountInfo), establishedAt);
   }

   @Override
   public String toString() {
      return MoreObjects.toStringHelper(this).add("id", this.id).toString();
   }

   @SuppressFBWarnings(justification = "generated code")
   public AccountLinkData(int id, String username, String providerId, String accountSub, Optional<String> accountInfo, LocalDateTime establishedAt) {
      this.id = id;
      this.username = username;
      this.providerId = providerId;
      this.accountSub = accountSub;
      this.accountInfo = accountInfo;
      this.establishedAt = establishedAt;
   }

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

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

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

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

   @SuppressFBWarnings(justification = "generated code")
   public Optional<String> getAccountInfo() {
      return this.accountInfo;
   }

   @SuppressFBWarnings(justification = "generated code")
   public LocalDateTime getEstablishedAt() {
      return this.establishedAt;
   }

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

         Object this$username = this.username;
         Object other$username = other.username;
         if (this$username == null ? other$username == null : this$username.equals(other$username)) {
            Object this$providerId = this.providerId;
            Object other$providerId = other.providerId;
            if (this$providerId == null ? other$providerId == null : this$providerId.equals(other$providerId)) {
               Object this$accountSub = this.accountSub;
               Object other$accountSub = other.accountSub;
               if (this$accountSub == null ? other$accountSub == null : this$accountSub.equals(other$accountSub)) {
                  Object this$accountInfo = this.accountInfo;
                  Object other$accountInfo = other.accountInfo;
                  if (this$accountInfo == null ? other$accountInfo == null : this$accountInfo.equals(other$accountInfo)) {
                     Object this$establishedAt = this.establishedAt;
                     Object other$establishedAt = other.establishedAt;
                     return this$establishedAt == null ? other$establishedAt == null : this$establishedAt.equals(other$establishedAt);
                  } 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.id;
      Object $username = this.username;
      result = result * 59 + ($username == null ? 43 : $username.hashCode());
      Object $providerId = this.providerId;
      result = result * 59 + ($providerId == null ? 43 : $providerId.hashCode());
      Object $accountSub = this.accountSub;
      result = result * 59 + ($accountSub == null ? 43 : $accountSub.hashCode());
      Object $accountInfo = this.accountInfo;
      result = result * 59 + ($accountInfo == null ? 43 : $accountInfo.hashCode());
      Object $establishedAt = this.establishedAt;
      return result * 59 + ($establishedAt == null ? 43 : $establishedAt.hashCode());
   }
}
