package com.airlock.iam.oauth2.infrastructure.transfer.response;

import com.fasterxml.jackson.annotation.JsonTypeName;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Instant;
import java.util.Map;

@JsonTypeName("oauth2-session")
public final class OAuth2SessionData {
   @Schema(description = "All custom attributes of an OAuth 2.0 session.")
   private Map<String, String> customAttributes;
   @Schema(description = "The OAuth 2.0 client ID.")
   private String clientId;
   @Schema(
      description = "The timestamp of the end of the flow where the user gave (explicitly or implicitly in case of disabled consent screen) their consent to this authorization."
   )
   private Instant consentTimestamp;
   @Schema(
      description = "Please use the value of 'consentTimestamp' instead (which holds the same timestamp). This parameter will be removed with IAM 9.0.The timestamp of the end of the flow where the user gave (explicitly or implicitly in case of disabled consent screen) their consent to this authorization.",
      deprecated = true
   )
   @Deprecated(forRemoval = true)
   private Instant authenticationTimestamp;

   @SuppressFBWarnings(justification = "generated code")
   public Map<String, String> getCustomAttributes() {
      return this.customAttributes;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public Instant getConsentTimestamp() {
      return this.consentTimestamp;
   }

   @Deprecated
   @SuppressFBWarnings(justification = "generated code")
   public Instant getAuthenticationTimestamp() {
      return this.authenticationTimestamp;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setCustomAttributes(Map<String, String> customAttributes) {
      this.customAttributes = customAttributes;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setClientId(String clientId) {
      this.clientId = clientId;
   }

   @SuppressFBWarnings(justification = "generated code")
   public void setConsentTimestamp(Instant consentTimestamp) {
      this.consentTimestamp = consentTimestamp;
   }

   @Deprecated
   @SuppressFBWarnings(justification = "generated code")
   public void setAuthenticationTimestamp(Instant authenticationTimestamp) {
      this.authenticationTimestamp = authenticationTimestamp;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "OAuth2SessionData(customAttributes="
         + this.getCustomAttributes()
         + ", clientId="
         + this.getClientId()
         + ", consentTimestamp="
         + this.getConsentTimestamp()
         + ", authenticationTimestamp="
         + this.getAuthenticationTimestamp()
         + ")";
   }
}
