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

import com.airlock.iam.oauth2.domain.model.claims.ScopeFormat;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.time.Duration;
import lombok.NonNull;

public final class OAuth2TokenExchangeGrantJwtTokenIssuerSettings {
   @NonNull
   private final ScopeFormat scopeFormat;
   @NonNull
   private final Duration issuedAccessTokenLifetime;

   @SuppressFBWarnings(justification = "generated code")
   OAuth2TokenExchangeGrantJwtTokenIssuerSettings(@NonNull ScopeFormat scopeFormat, @NonNull Duration issuedAccessTokenLifetime) {
      if (scopeFormat == null) {
         throw new NullPointerException("scopeFormat is marked non-null but is null");
      }

      if (issuedAccessTokenLifetime == null) {
         throw new NullPointerException("issuedAccessTokenLifetime is marked non-null but is null");
      }

      this.scopeFormat = scopeFormat;
      this.issuedAccessTokenLifetime = issuedAccessTokenLifetime;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static OAuth2TokenExchangeGrantJwtTokenIssuerSettings.OAuth2TokenExchangeGrantJwtTokenIssuerSettingsBuilder builder() {
      return new OAuth2TokenExchangeGrantJwtTokenIssuerSettings.OAuth2TokenExchangeGrantJwtTokenIssuerSettingsBuilder();
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public ScopeFormat getScopeFormat() {
      return this.scopeFormat;
   }

   @NonNull
   @SuppressFBWarnings(justification = "generated code")
   public Duration getIssuedAccessTokenLifetime() {
      return this.issuedAccessTokenLifetime;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "OAuth2TokenExchangeGrantJwtTokenIssuerSettings(scopeFormat="
         + this.getScopeFormat()
         + ", issuedAccessTokenLifetime="
         + this.getIssuedAccessTokenLifetime()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class OAuth2TokenExchangeGrantJwtTokenIssuerSettingsBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private ScopeFormat scopeFormat;
      @SuppressFBWarnings(justification = "generated code")
      private Duration issuedAccessTokenLifetime;

      @SuppressFBWarnings(justification = "generated code")
      OAuth2TokenExchangeGrantJwtTokenIssuerSettingsBuilder() {
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TokenExchangeGrantJwtTokenIssuerSettings.OAuth2TokenExchangeGrantJwtTokenIssuerSettingsBuilder scopeFormat(@NonNull ScopeFormat scopeFormat) {
         if (scopeFormat == null) {
            throw new NullPointerException("scopeFormat is marked non-null but is null");
         }

         this.scopeFormat = scopeFormat;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TokenExchangeGrantJwtTokenIssuerSettings.OAuth2TokenExchangeGrantJwtTokenIssuerSettingsBuilder issuedAccessTokenLifetime(
         @NonNull Duration issuedAccessTokenLifetime
      ) {
         if (issuedAccessTokenLifetime == null) {
            throw new NullPointerException("issuedAccessTokenLifetime is marked non-null but is null");
         }

         this.issuedAccessTokenLifetime = issuedAccessTokenLifetime;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TokenExchangeGrantJwtTokenIssuerSettings build() {
         return new OAuth2TokenExchangeGrantJwtTokenIssuerSettings(this.scopeFormat, this.issuedAccessTokenLifetime);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "OAuth2TokenExchangeGrantJwtTokenIssuerSettings.OAuth2TokenExchangeGrantJwtTokenIssuerSettingsBuilder(scopeFormat="
            + this.scopeFormat
            + ", issuedAccessTokenLifetime="
            + this.issuedAccessTokenLifetime
            + ")";
      }
   }
}
