package com.airlock.iam.oauth2.domain.service.token;

import com.airlock.iam.common.api.domain.model.claims.Claim;
import com.airlock.iam.oauth2.api.domain.model.OAuth2ClientId;
import com.airlock.iam.oauth2.api.domain.model.OAuth2Scope;
import com.airlock.iam.oauth2.api.domain.model.claims.OAuth2ClaimSessionId;
import com.airlock.iam.oauth2.api.domain.model.claims.OAuth2TokenClaimData;
import com.airlock.iam.oauth2.domain.model.token.OAuth2TokenBinding;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.Set;

public final class TokenGeneratorData implements OAuth2TokenClaimData {
   private final Date generationDate;
   private final Set<OAuth2Scope> scopes;
   private final Optional<OAuth2TokenBinding> binding;
   private final OAuth2ClientId clientId;
   private final OAuth2ClaimSessionId sessionId;
   private final List<Claim<?>> claims;

   @SuppressFBWarnings(justification = "generated code")
   public TokenGeneratorData(
      Date generationDate,
      Set<OAuth2Scope> scopes,
      Optional<OAuth2TokenBinding> binding,
      OAuth2ClientId clientId,
      OAuth2ClaimSessionId sessionId,
      List<Claim<?>> claims
   ) {
      this.generationDate = generationDate;
      this.scopes = scopes;
      this.binding = binding;
      this.clientId = clientId;
      this.sessionId = sessionId;
      this.claims = claims;
   }

   @SuppressFBWarnings(justification = "generated code")
   public Date getGenerationDate() {
      return this.generationDate;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Set<OAuth2Scope> getScopes() {
      return this.scopes;
   }

   @SuppressFBWarnings(justification = "generated code")
   public Optional<OAuth2TokenBinding> getBinding() {
      return this.binding;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public OAuth2ClientId getClientId() {
      return this.clientId;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public OAuth2ClaimSessionId getSessionId() {
      return this.sessionId;
   }

   @SuppressFBWarnings(justification = "generated code")
   public List<Claim<?>> getClaims() {
      return this.claims;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof TokenGeneratorData other)) {
         return false;
      } else {
         Object this$generationDate = this.generationDate;
         Object other$generationDate = other.generationDate;
         if (this$generationDate == null ? other$generationDate == null : this$generationDate.equals(other$generationDate)) {
            Object this$scopes = this.scopes;
            Object other$scopes = other.scopes;
            if (this$scopes == null ? other$scopes == null : this$scopes.equals(other$scopes)) {
               Object this$binding = this.binding;
               Object other$binding = other.binding;
               if (this$binding == null ? other$binding == null : this$binding.equals(other$binding)) {
                  Object this$clientId = this.clientId;
                  Object other$clientId = other.clientId;
                  if (this$clientId == null ? other$clientId == null : this$clientId.equals(other$clientId)) {
                     Object this$sessionId = this.sessionId;
                     Object other$sessionId = other.sessionId;
                     if (this$sessionId == null ? other$sessionId == null : this$sessionId.equals(other$sessionId)) {
                        Object this$claims = this.claims;
                        Object other$claims = other.claims;
                        return this$claims == null ? other$claims == null : this$claims.equals(other$claims);
                     } 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;
      Object $generationDate = this.generationDate;
      result = result * 59 + ($generationDate == null ? 43 : $generationDate.hashCode());
      Object $scopes = this.scopes;
      result = result * 59 + ($scopes == null ? 43 : $scopes.hashCode());
      Object $binding = this.binding;
      result = result * 59 + ($binding == null ? 43 : $binding.hashCode());
      Object $clientId = this.clientId;
      result = result * 59 + ($clientId == null ? 43 : $clientId.hashCode());
      Object $sessionId = this.sessionId;
      result = result * 59 + ($sessionId == null ? 43 : $sessionId.hashCode());
      Object $claims = this.claims;
      return result * 59 + ($claims == null ? 43 : $claims.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "TokenGeneratorData(generationDate="
         + this.getGenerationDate()
         + ", scopes="
         + this.getScopes()
         + ", binding="
         + this.getBinding()
         + ", clientId="
         + this.getClientId()
         + ", sessionId="
         + this.getSessionId()
         + ", claims="
         + this.getClaims()
         + ")";
   }
}
