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

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@JsonIgnoreProperties(ignoreUnknown = true)
public class RemoteAccessTokenResponse {
   private final String accessToken;
   private final Long expiresIn;

   @JsonCreator
   public RemoteAccessTokenResponse(
      @JsonProperty(value = "access_token", required = true) @JsonAlias("access_token") String accessToken,
      @JsonProperty(value = "expires_in", required = true) @JsonAlias("expires_in") Long expiresIn
   ) {
      this.accessToken = accessToken;
      this.expiresIn = expiresIn;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public Long getExpiresIn() {
      return this.expiresIn;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   protected boolean canEqual(Object other) {
      return other instanceof RemoteAccessTokenResponse;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "RemoteAccessTokenResponse(accessToken=" + this.getAccessToken() + ", expiresIn=" + this.getExpiresIn() + ")";
   }
}
