package com.airlock.iam.techclient.auth.domain.model.oauth2;

import com.airlock.iam.base.api.domain.model.exception.FailureException;
import com.airlock.iam.oauth2.api.domain.model.AuthorizationServerId;
import com.airlock.iam.oauth2.api.domain.model.OAuth2ClientId;
import com.airlock.iam.oauth2.api.domain.model.OAuth2ClientSecret;
import com.airlock.iam.oauth2.api.domain.model.OAuth2Scope;
import com.airlock.iam.techclient.api.domain.model.oauth2.MtlsCertificate;
import com.airlock.iam.techclient.api.domain.model.oauth2.MutableOAuth2TechnicalClientMetadata;
import com.airlock.iam.techclient.api.domain.model.oauth2.OAuth2TechnicalClientMetadata;
import com.airlock.iam.techclient.api.domain.model.oauth2.OAuth2TechnicalClientMetadataBuilder;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.net.URI;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.Map.Entry;

public final class OAuth2TechClientMetadataImpl implements MutableOAuth2TechnicalClientMetadata {
   public static final int MAX_URI_LENGTH = 200;
   private OAuth2ClientId clientId;
   private AuthorizationServerId authorizationServerId;
   private Optional<OAuth2ClientSecret> clientSecret;
   private Optional<String> clientName;
   public static final int CLIENT_NAME_LENGTH = 200;
   private Map<Locale, String> clientNameTranslations;
   private Optional<Instant> clientIdIssuedAt;
   private Set<URI> redirectUris;
   private Optional<String> tokenEndpointAuthMethod;
   public static final int TOKEN_ENDPOINT_AUTH_METHOD_LENGTH = 50;
   private List<String> grantTypes;
   private List<String> responseTypes;
   private Optional<URI> clientUri;
   private Map<Locale, URI> clientUriTranslations;
   private Optional<URI> logoUri;
   private Map<Locale, URI> logoUriTranslations;
   private List<OAuth2Scope> scopes;
   private List<String> contacts;
   public static final int MAX_CONTACT_LENGTH = 200;
   private Optional<URI> tosUri;
   private Map<Locale, URI> tosUriTranslations;
   private Optional<URI> policyUri;
   private Map<Locale, URI> policyUriTranslations;
   private Optional<URI> jwksUri;
   private Optional<String> softwareId;
   private Optional<String> softwareVersion;
   public static final int MAX_SOFTWARE_ID_AND_VERSION_LENGTH = 50;
   private Optional<MtlsCertificate> mtlsCertificate;

   private OAuth2TechClientMetadataImpl(OAuth2ClientId clientId, AuthorizationServerId authorizationServerId) {
      this.clientId = clientId;
      this.authorizationServerId = authorizationServerId;
      this.clientSecret = Optional.empty();
      this.clientName = Optional.empty();
      this.clientNameTranslations = Map.of();
      this.clientIdIssuedAt = Optional.empty();
      this.redirectUris = Set.of();
      this.tokenEndpointAuthMethod = Optional.empty();
      this.grantTypes = List.of();
      this.responseTypes = List.of();
      this.clientUri = Optional.empty();
      this.clientUriTranslations = Map.of();
      this.logoUri = Optional.empty();
      this.logoUriTranslations = Map.of();
      this.scopes = List.of();
      this.contacts = List.of();
      this.tosUri = Optional.empty();
      this.tosUriTranslations = Map.of();
      this.policyUri = Optional.empty();
      this.policyUriTranslations = Map.of();
      this.jwksUri = Optional.empty();
      this.softwareId = Optional.empty();
      this.softwareVersion = Optional.empty();
      this.mtlsCertificate = Optional.empty();
   }

   public static OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder builder(OAuth2ClientId clientId, AuthorizationServerId authorizationServerId) {
      return new OAuth2TechClientMetadataImpl(clientId, authorizationServerId).toBuilder();
   }

   public static MutableOAuth2TechnicalClientMetadata asMutable(OAuth2TechnicalClientMetadata metadata) {
      if (metadata instanceof OAuth2TechClientMetadataImpl) {
         return (OAuth2TechClientMetadataImpl)metadata;
      } else {
         throw new FailureException("Unsupported implementation of OAuth2TechnicalClientMetadata.");
      }
   }

   @Override
   public Optional<String> getClientName(Locale lang) {
      return Optional.ofNullable(this.clientNameTranslations.get(lang)).or(() -> this.clientName);
   }

   @Override
   public Optional<URI> getClientUri(Locale lang) {
      return Optional.ofNullable(this.clientUriTranslations.get(lang)).or(() -> this.clientUri);
   }

   @Override
   public Optional<URI> getLogoUri(Locale lang) {
      return Optional.ofNullable(this.logoUriTranslations.get(lang)).or(() -> this.logoUri);
   }

   @Override
   public Optional<URI> getTosUri(Locale lang) {
      return Optional.ofNullable(this.tosUriTranslations.get(lang)).or(() -> this.tosUri);
   }

   @Override
   public Optional<URI> getPolicyUri(Locale lang) {
      return Optional.ofNullable(this.policyUriTranslations.get(lang)).or(() -> this.policyUri);
   }

   @SuppressFBWarnings(justification = "generated code")
   public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder toBuilder() {
      OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder builder = new OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder()
         .clientId(this.clientId)
         .authorizationServerId(this.authorizationServerId)
         .clientSecret(this.clientSecret)
         .clientName(this.clientName)
         .clientIdIssuedAt(this.clientIdIssuedAt)
         .redirectUris(this.redirectUris)
         .tokenEndpointAuthMethod(this.tokenEndpointAuthMethod)
         .clientUri(this.clientUri)
         .logoUri(this.logoUri)
         .contacts(this.contacts)
         .tosUri(this.tosUri)
         .policyUri(this.policyUri)
         .jwksUri(this.jwksUri)
         .softwareId(this.softwareId)
         .softwareVersion(this.softwareVersion)
         .mtlsCertificate(this.mtlsCertificate);
      if (this.clientNameTranslations != null) {
         builder.clientNameTranslations(this.clientNameTranslations);
      }

      if (this.grantTypes != null) {
         builder.grantTypes(this.grantTypes);
      }

      if (this.responseTypes != null) {
         builder.responseTypes(this.responseTypes);
      }

      if (this.clientUriTranslations != null) {
         builder.clientUriTranslations(this.clientUriTranslations);
      }

      if (this.logoUriTranslations != null) {
         builder.logoUriTranslations(this.logoUriTranslations);
      }

      if (this.scopes != null) {
         builder.scopes(this.scopes);
      }

      if (this.tosUriTranslations != null) {
         builder.tosUriTranslations(this.tosUriTranslations);
      }

      if (this.policyUriTranslations != null) {
         builder.policyUriTranslations(this.policyUriTranslations);
      }

      return builder;
   }

   @SuppressFBWarnings(justification = "generated code")
   public OAuth2TechClientMetadataImpl(
      OAuth2ClientId clientId,
      AuthorizationServerId authorizationServerId,
      Optional<OAuth2ClientSecret> clientSecret,
      Optional<String> clientName,
      Map<Locale, String> clientNameTranslations,
      Optional<Instant> clientIdIssuedAt,
      Set<URI> redirectUris,
      Optional<String> tokenEndpointAuthMethod,
      List<String> grantTypes,
      List<String> responseTypes,
      Optional<URI> clientUri,
      Map<Locale, URI> clientUriTranslations,
      Optional<URI> logoUri,
      Map<Locale, URI> logoUriTranslations,
      List<OAuth2Scope> scopes,
      List<String> contacts,
      Optional<URI> tosUri,
      Map<Locale, URI> tosUriTranslations,
      Optional<URI> policyUri,
      Map<Locale, URI> policyUriTranslations,
      Optional<URI> jwksUri,
      Optional<String> softwareId,
      Optional<String> softwareVersion,
      Optional<MtlsCertificate> mtlsCertificate
   ) {
      this.clientId = clientId;
      this.authorizationServerId = authorizationServerId;
      this.clientSecret = clientSecret;
      this.clientName = clientName;
      this.clientNameTranslations = clientNameTranslations;
      this.clientIdIssuedAt = clientIdIssuedAt;
      this.redirectUris = redirectUris;
      this.tokenEndpointAuthMethod = tokenEndpointAuthMethod;
      this.grantTypes = grantTypes;
      this.responseTypes = responseTypes;
      this.clientUri = clientUri;
      this.clientUriTranslations = clientUriTranslations;
      this.logoUri = logoUri;
      this.logoUriTranslations = logoUriTranslations;
      this.scopes = scopes;
      this.contacts = contacts;
      this.tosUri = tosUri;
      this.tosUriTranslations = tosUriTranslations;
      this.policyUri = policyUri;
      this.policyUriTranslations = policyUriTranslations;
      this.jwksUri = jwksUri;
      this.softwareId = softwareId;
      this.softwareVersion = softwareVersion;
      this.mtlsCertificate = mtlsCertificate;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public AuthorizationServerId getAuthorizationServerId() {
      return this.authorizationServerId;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<OAuth2ClientSecret> getClientSecret() {
      return this.clientSecret;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Map<Locale, String> getClientNameTranslations() {
      return this.clientNameTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<Instant> getClientIdIssuedAt() {
      return this.clientIdIssuedAt;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Set<URI> getRedirectUris() {
      return this.redirectUris;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public List<String> getGrantTypes() {
      return this.grantTypes;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public List<String> getResponseTypes() {
      return this.responseTypes;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<URI> getClientUri() {
      return this.clientUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Map<Locale, URI> getClientUriTranslations() {
      return this.clientUriTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<URI> getLogoUri() {
      return this.logoUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Map<Locale, URI> getLogoUriTranslations() {
      return this.logoUriTranslations;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public List<String> getContacts() {
      return this.contacts;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<URI> getTosUri() {
      return this.tosUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Map<Locale, URI> getTosUriTranslations() {
      return this.tosUriTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<URI> getPolicyUri() {
      return this.policyUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Map<Locale, URI> getPolicyUriTranslations() {
      return this.policyUriTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<URI> getJwksUri() {
      return this.jwksUri;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public Optional<MtlsCertificate> getMtlsCertificate() {
      return this.mtlsCertificate;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setAuthorizationServerId(AuthorizationServerId authorizationServerId) {
      this.authorizationServerId = authorizationServerId;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setClientSecret(Optional<OAuth2ClientSecret> clientSecret) {
      this.clientSecret = clientSecret;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setClientName(Optional<String> clientName) {
      this.clientName = clientName;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setClientNameTranslations(Map<Locale, String> clientNameTranslations) {
      this.clientNameTranslations = clientNameTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setClientIdIssuedAt(Optional<Instant> clientIdIssuedAt) {
      this.clientIdIssuedAt = clientIdIssuedAt;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setRedirectUris(Set<URI> redirectUris) {
      this.redirectUris = redirectUris;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setTokenEndpointAuthMethod(Optional<String> tokenEndpointAuthMethod) {
      this.tokenEndpointAuthMethod = tokenEndpointAuthMethod;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setGrantTypes(List<String> grantTypes) {
      this.grantTypes = grantTypes;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setResponseTypes(List<String> responseTypes) {
      this.responseTypes = responseTypes;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setClientUri(Optional<URI> clientUri) {
      this.clientUri = clientUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setClientUriTranslations(Map<Locale, URI> clientUriTranslations) {
      this.clientUriTranslations = clientUriTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setLogoUri(Optional<URI> logoUri) {
      this.logoUri = logoUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setLogoUriTranslations(Map<Locale, URI> logoUriTranslations) {
      this.logoUriTranslations = logoUriTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setScopes(List<OAuth2Scope> scopes) {
      this.scopes = scopes;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setContacts(List<String> contacts) {
      this.contacts = contacts;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setTosUri(Optional<URI> tosUri) {
      this.tosUri = tosUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setTosUriTranslations(Map<Locale, URI> tosUriTranslations) {
      this.tosUriTranslations = tosUriTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setPolicyUri(Optional<URI> policyUri) {
      this.policyUri = policyUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setPolicyUriTranslations(Map<Locale, URI> policyUriTranslations) {
      this.policyUriTranslations = policyUriTranslations;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setJwksUri(Optional<URI> jwksUri) {
      this.jwksUri = jwksUri;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setSoftwareId(Optional<String> softwareId) {
      this.softwareId = softwareId;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setSoftwareVersion(Optional<String> softwareVersion) {
      this.softwareVersion = softwareVersion;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public void setMtlsCertificate(Optional<MtlsCertificate> mtlsCertificate) {
      this.mtlsCertificate = mtlsCertificate;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof OAuth2TechClientMetadataImpl other)) {
         return false;
      } else {
         Object this$clientId = this.clientId;
         Object other$clientId = other.clientId;
         if (this$clientId == null ? other$clientId == null : this$clientId.equals(other$clientId)) {
            Object this$authorizationServerId = this.authorizationServerId;
            Object other$authorizationServerId = other.authorizationServerId;
            if (this$authorizationServerId == null ? other$authorizationServerId == null : this$authorizationServerId.equals(other$authorizationServerId)) {
               Object this$clientSecret = this.clientSecret;
               Object other$clientSecret = other.clientSecret;
               if (this$clientSecret == null ? other$clientSecret == null : this$clientSecret.equals(other$clientSecret)) {
                  Object this$clientName = this.clientName;
                  Object other$clientName = other.clientName;
                  if (this$clientName == null ? other$clientName == null : this$clientName.equals(other$clientName)) {
                     Object this$clientNameTranslations = this.clientNameTranslations;
                     Object other$clientNameTranslations = other.clientNameTranslations;
                     if (this$clientNameTranslations == null
                        ? other$clientNameTranslations == null
                        : this$clientNameTranslations.equals(other$clientNameTranslations)) {
                        Object this$clientIdIssuedAt = this.clientIdIssuedAt;
                        Object other$clientIdIssuedAt = other.clientIdIssuedAt;
                        if (this$clientIdIssuedAt == null ? other$clientIdIssuedAt == null : this$clientIdIssuedAt.equals(other$clientIdIssuedAt)) {
                           Object this$redirectUris = this.redirectUris;
                           Object other$redirectUris = other.redirectUris;
                           if (this$redirectUris == null ? other$redirectUris == null : this$redirectUris.equals(other$redirectUris)) {
                              Object this$tokenEndpointAuthMethod = this.tokenEndpointAuthMethod;
                              Object other$tokenEndpointAuthMethod = other.tokenEndpointAuthMethod;
                              if (this$tokenEndpointAuthMethod == null
                                 ? other$tokenEndpointAuthMethod == null
                                 : this$tokenEndpointAuthMethod.equals(other$tokenEndpointAuthMethod)) {
                                 Object this$grantTypes = this.grantTypes;
                                 Object other$grantTypes = other.grantTypes;
                                 if (this$grantTypes == null ? other$grantTypes == null : this$grantTypes.equals(other$grantTypes)) {
                                    Object this$responseTypes = this.responseTypes;
                                    Object other$responseTypes = other.responseTypes;
                                    if (this$responseTypes == null ? other$responseTypes == null : this$responseTypes.equals(other$responseTypes)) {
                                       Object this$clientUri = this.clientUri;
                                       Object other$clientUri = other.clientUri;
                                       if (this$clientUri == null ? other$clientUri == null : this$clientUri.equals(other$clientUri)) {
                                          Object this$clientUriTranslations = this.clientUriTranslations;
                                          Object other$clientUriTranslations = other.clientUriTranslations;
                                          if (this$clientUriTranslations == null
                                             ? other$clientUriTranslations == null
                                             : this$clientUriTranslations.equals(other$clientUriTranslations)) {
                                             Object this$logoUri = this.logoUri;
                                             Object other$logoUri = other.logoUri;
                                             if (this$logoUri == null ? other$logoUri == null : this$logoUri.equals(other$logoUri)) {
                                                Object this$logoUriTranslations = this.logoUriTranslations;
                                                Object other$logoUriTranslations = other.logoUriTranslations;
                                                if (this$logoUriTranslations == null
                                                   ? other$logoUriTranslations == null
                                                   : this$logoUriTranslations.equals(other$logoUriTranslations)) {
                                                   Object this$scopes = this.scopes;
                                                   Object other$scopes = other.scopes;
                                                   if (this$scopes == null ? other$scopes == null : this$scopes.equals(other$scopes)) {
                                                      Object this$contacts = this.contacts;
                                                      Object other$contacts = other.contacts;
                                                      if (this$contacts == null ? other$contacts == null : this$contacts.equals(other$contacts)) {
                                                         Object this$tosUri = this.tosUri;
                                                         Object other$tosUri = other.tosUri;
                                                         if (this$tosUri == null ? other$tosUri == null : this$tosUri.equals(other$tosUri)) {
                                                            Object this$tosUriTranslations = this.tosUriTranslations;
                                                            Object other$tosUriTranslations = other.tosUriTranslations;
                                                            if (this$tosUriTranslations == null
                                                               ? other$tosUriTranslations == null
                                                               : this$tosUriTranslations.equals(other$tosUriTranslations)) {
                                                               Object this$policyUri = this.policyUri;
                                                               Object other$policyUri = other.policyUri;
                                                               if (this$policyUri == null ? other$policyUri == null : this$policyUri.equals(other$policyUri)) {
                                                                  Object this$policyUriTranslations = this.policyUriTranslations;
                                                                  Object other$policyUriTranslations = other.policyUriTranslations;
                                                                  if (this$policyUriTranslations == null
                                                                     ? other$policyUriTranslations == null
                                                                     : this$policyUriTranslations.equals(other$policyUriTranslations)) {
                                                                     Object this$jwksUri = this.jwksUri;
                                                                     Object other$jwksUri = other.jwksUri;
                                                                     if (this$jwksUri == null ? other$jwksUri == null : this$jwksUri.equals(other$jwksUri)) {
                                                                        Object this$softwareId = this.softwareId;
                                                                        Object other$softwareId = other.softwareId;
                                                                        if (this$softwareId == null
                                                                           ? other$softwareId == null
                                                                           : this$softwareId.equals(other$softwareId)) {
                                                                           Object this$softwareVersion = this.softwareVersion;
                                                                           Object other$softwareVersion = other.softwareVersion;
                                                                           if (this$softwareVersion == null
                                                                              ? other$softwareVersion == null
                                                                              : this$softwareVersion.equals(other$softwareVersion)) {
                                                                              Object this$mtlsCertificate = this.mtlsCertificate;
                                                                              Object other$mtlsCertificate = other.mtlsCertificate;
                                                                              return this$mtlsCertificate == null
                                                                                 ? other$mtlsCertificate == null
                                                                                 : this$mtlsCertificate.equals(other$mtlsCertificate);
                                                                           } else {
                                                                              return false;
                                                                           }
                                                                        } else {
                                                                           return false;
                                                                        }
                                                                     } else {
                                                                        return false;
                                                                     }
                                                                  } else {
                                                                     return false;
                                                                  }
                                                               } else {
                                                                  return false;
                                                               }
                                                            } else {
                                                               return false;
                                                            }
                                                         } else {
                                                            return false;
                                                         }
                                                      } else {
                                                         return false;
                                                      }
                                                   } else {
                                                      return false;
                                                   }
                                                } else {
                                                   return false;
                                                }
                                             } else {
                                                return false;
                                             }
                                          } else {
                                             return false;
                                          }
                                       } else {
                                          return false;
                                       }
                                    } else {
                                       return false;
                                    }
                                 } else {
                                    return false;
                                 }
                              } else {
                                 return false;
                              }
                           } else {
                              return false;
                           }
                        } else {
                           return false;
                        }
                     } 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 $clientId = this.clientId;
      result = result * 59 + ($clientId == null ? 43 : $clientId.hashCode());
      Object $authorizationServerId = this.authorizationServerId;
      result = result * 59 + ($authorizationServerId == null ? 43 : $authorizationServerId.hashCode());
      Object $clientSecret = this.clientSecret;
      result = result * 59 + ($clientSecret == null ? 43 : $clientSecret.hashCode());
      Object $clientName = this.clientName;
      result = result * 59 + ($clientName == null ? 43 : $clientName.hashCode());
      Object $clientNameTranslations = this.clientNameTranslations;
      result = result * 59 + ($clientNameTranslations == null ? 43 : $clientNameTranslations.hashCode());
      Object $clientIdIssuedAt = this.clientIdIssuedAt;
      result = result * 59 + ($clientIdIssuedAt == null ? 43 : $clientIdIssuedAt.hashCode());
      Object $redirectUris = this.redirectUris;
      result = result * 59 + ($redirectUris == null ? 43 : $redirectUris.hashCode());
      Object $tokenEndpointAuthMethod = this.tokenEndpointAuthMethod;
      result = result * 59 + ($tokenEndpointAuthMethod == null ? 43 : $tokenEndpointAuthMethod.hashCode());
      Object $grantTypes = this.grantTypes;
      result = result * 59 + ($grantTypes == null ? 43 : $grantTypes.hashCode());
      Object $responseTypes = this.responseTypes;
      result = result * 59 + ($responseTypes == null ? 43 : $responseTypes.hashCode());
      Object $clientUri = this.clientUri;
      result = result * 59 + ($clientUri == null ? 43 : $clientUri.hashCode());
      Object $clientUriTranslations = this.clientUriTranslations;
      result = result * 59 + ($clientUriTranslations == null ? 43 : $clientUriTranslations.hashCode());
      Object $logoUri = this.logoUri;
      result = result * 59 + ($logoUri == null ? 43 : $logoUri.hashCode());
      Object $logoUriTranslations = this.logoUriTranslations;
      result = result * 59 + ($logoUriTranslations == null ? 43 : $logoUriTranslations.hashCode());
      Object $scopes = this.scopes;
      result = result * 59 + ($scopes == null ? 43 : $scopes.hashCode());
      Object $contacts = this.contacts;
      result = result * 59 + ($contacts == null ? 43 : $contacts.hashCode());
      Object $tosUri = this.tosUri;
      result = result * 59 + ($tosUri == null ? 43 : $tosUri.hashCode());
      Object $tosUriTranslations = this.tosUriTranslations;
      result = result * 59 + ($tosUriTranslations == null ? 43 : $tosUriTranslations.hashCode());
      Object $policyUri = this.policyUri;
      result = result * 59 + ($policyUri == null ? 43 : $policyUri.hashCode());
      Object $policyUriTranslations = this.policyUriTranslations;
      result = result * 59 + ($policyUriTranslations == null ? 43 : $policyUriTranslations.hashCode());
      Object $jwksUri = this.jwksUri;
      result = result * 59 + ($jwksUri == null ? 43 : $jwksUri.hashCode());
      Object $softwareId = this.softwareId;
      result = result * 59 + ($softwareId == null ? 43 : $softwareId.hashCode());
      Object $softwareVersion = this.softwareVersion;
      result = result * 59 + ($softwareVersion == null ? 43 : $softwareVersion.hashCode());
      Object $mtlsCertificate = this.mtlsCertificate;
      return result * 59 + ($mtlsCertificate == null ? 43 : $mtlsCertificate.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "OAuth2TechClientMetadataImpl(clientId="
         + this.getClientId()
         + ", authorizationServerId="
         + this.getAuthorizationServerId()
         + ", clientSecret="
         + this.getClientSecret()
         + ", clientName="
         + this.getClientName()
         + ", clientNameTranslations="
         + this.getClientNameTranslations()
         + ", clientIdIssuedAt="
         + this.getClientIdIssuedAt()
         + ", redirectUris="
         + this.getRedirectUris()
         + ", tokenEndpointAuthMethod="
         + this.getTokenEndpointAuthMethod()
         + ", grantTypes="
         + this.getGrantTypes()
         + ", responseTypes="
         + this.getResponseTypes()
         + ", clientUri="
         + this.getClientUri()
         + ", clientUriTranslations="
         + this.getClientUriTranslations()
         + ", logoUri="
         + this.getLogoUri()
         + ", logoUriTranslations="
         + this.getLogoUriTranslations()
         + ", scopes="
         + this.getScopes()
         + ", contacts="
         + this.getContacts()
         + ", tosUri="
         + this.getTosUri()
         + ", tosUriTranslations="
         + this.getTosUriTranslations()
         + ", policyUri="
         + this.getPolicyUri()
         + ", policyUriTranslations="
         + this.getPolicyUriTranslations()
         + ", jwksUri="
         + this.getJwksUri()
         + ", softwareId="
         + this.getSoftwareId()
         + ", softwareVersion="
         + this.getSoftwareVersion()
         + ", mtlsCertificate="
         + this.getMtlsCertificate()
         + ")";
   }

   public static class OAuth2TechClientMetadataImplBuilder implements OAuth2TechnicalClientMetadataBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private OAuth2ClientId clientId;
      @SuppressFBWarnings(justification = "generated code")
      private AuthorizationServerId authorizationServerId;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<OAuth2ClientSecret> clientSecret;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<String> clientName;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<Locale> clientNameTranslations$key;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<String> clientNameTranslations$value;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<Instant> clientIdIssuedAt;
      @SuppressFBWarnings(justification = "generated code")
      private Set<URI> redirectUris;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<String> tokenEndpointAuthMethod;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<String> grantTypes;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<String> responseTypes;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<URI> clientUri;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<Locale> clientUriTranslations$key;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<URI> clientUriTranslations$value;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<URI> logoUri;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<Locale> logoUriTranslations$key;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<URI> logoUriTranslations$value;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<OAuth2Scope> scopes;
      @SuppressFBWarnings(justification = "generated code")
      private List<String> contacts;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<URI> tosUri;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<Locale> tosUriTranslations$key;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<URI> tosUriTranslations$value;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<URI> policyUri;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<Locale> policyUriTranslations$key;
      @SuppressFBWarnings(justification = "generated code")
      private ArrayList<URI> policyUriTranslations$value;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<URI> jwksUri;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<String> softwareId;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<String> softwareVersion;
      @SuppressFBWarnings(justification = "generated code")
      private Optional<MtlsCertificate> mtlsCertificate;

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

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

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder authorizationServerId(AuthorizationServerId authorizationServerId) {
         this.authorizationServerId = authorizationServerId;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clientSecret(Optional<OAuth2ClientSecret> clientSecret) {
         this.clientSecret = clientSecret;
         return this;
      }

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

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clientNameTranslation(
         Locale clientNameTranslationKey, String clientNameTranslationValue
      ) {
         if (this.clientNameTranslations$key == null) {
            this.clientNameTranslations$key = new ArrayList<>();
            this.clientNameTranslations$value = new ArrayList<>();
         }

         this.clientNameTranslations$key.add(clientNameTranslationKey);
         this.clientNameTranslations$value.add(clientNameTranslationValue);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clientNameTranslations(
         Map<? extends Locale, ? extends String> clientNameTranslations
      ) {
         if (clientNameTranslations == null) {
            throw new NullPointerException("clientNameTranslations cannot be null");
         }

         if (this.clientNameTranslations$key == null) {
            this.clientNameTranslations$key = new ArrayList<>();
            this.clientNameTranslations$value = new ArrayList<>();
         }

         for (Entry<? extends Locale, ? extends String> $lombokEntry : clientNameTranslations.entrySet()) {
            this.clientNameTranslations$key.add($lombokEntry.getKey());
            this.clientNameTranslations$value.add($lombokEntry.getValue());
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearClientNameTranslations() {
         if (this.clientNameTranslations$key != null) {
            this.clientNameTranslations$key.clear();
            this.clientNameTranslations$value.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clientIdIssuedAt(Optional<Instant> clientIdIssuedAt) {
         this.clientIdIssuedAt = clientIdIssuedAt;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder redirectUris(Set<URI> redirectUris) {
         this.redirectUris = redirectUris;
         return this;
      }

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

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder grantType(String grantType) {
         if (this.grantTypes == null) {
            this.grantTypes = new ArrayList<>();
         }

         this.grantTypes.add(grantType);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder grantTypes(Collection<? extends String> grantTypes) {
         if (grantTypes == null) {
            throw new NullPointerException("grantTypes cannot be null");
         }

         if (this.grantTypes == null) {
            this.grantTypes = new ArrayList<>();
         }

         this.grantTypes.addAll(grantTypes);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearGrantTypes() {
         if (this.grantTypes != null) {
            this.grantTypes.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder responseType(String responseType) {
         if (this.responseTypes == null) {
            this.responseTypes = new ArrayList<>();
         }

         this.responseTypes.add(responseType);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder responseTypes(Collection<? extends String> responseTypes) {
         if (responseTypes == null) {
            throw new NullPointerException("responseTypes cannot be null");
         }

         if (this.responseTypes == null) {
            this.responseTypes = new ArrayList<>();
         }

         this.responseTypes.addAll(responseTypes);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearResponseTypes() {
         if (this.responseTypes != null) {
            this.responseTypes.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clientUri(Optional<URI> clientUri) {
         this.clientUri = clientUri;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clientUriTranslation(
         Locale clientUriTranslationKey, URI clientUriTranslationValue
      ) {
         if (this.clientUriTranslations$key == null) {
            this.clientUriTranslations$key = new ArrayList<>();
            this.clientUriTranslations$value = new ArrayList<>();
         }

         this.clientUriTranslations$key.add(clientUriTranslationKey);
         this.clientUriTranslations$value.add(clientUriTranslationValue);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clientUriTranslations(Map<? extends Locale, ? extends URI> clientUriTranslations) {
         if (clientUriTranslations == null) {
            throw new NullPointerException("clientUriTranslations cannot be null");
         }

         if (this.clientUriTranslations$key == null) {
            this.clientUriTranslations$key = new ArrayList<>();
            this.clientUriTranslations$value = new ArrayList<>();
         }

         for (Entry<? extends Locale, ? extends URI> $lombokEntry : clientUriTranslations.entrySet()) {
            this.clientUriTranslations$key.add($lombokEntry.getKey());
            this.clientUriTranslations$value.add($lombokEntry.getValue());
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearClientUriTranslations() {
         if (this.clientUriTranslations$key != null) {
            this.clientUriTranslations$key.clear();
            this.clientUriTranslations$value.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder logoUri(Optional<URI> logoUri) {
         this.logoUri = logoUri;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder logoUriTranslation(Locale logoUriTranslationKey, URI logoUriTranslationValue) {
         if (this.logoUriTranslations$key == null) {
            this.logoUriTranslations$key = new ArrayList<>();
            this.logoUriTranslations$value = new ArrayList<>();
         }

         this.logoUriTranslations$key.add(logoUriTranslationKey);
         this.logoUriTranslations$value.add(logoUriTranslationValue);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder logoUriTranslations(Map<? extends Locale, ? extends URI> logoUriTranslations) {
         if (logoUriTranslations == null) {
            throw new NullPointerException("logoUriTranslations cannot be null");
         }

         if (this.logoUriTranslations$key == null) {
            this.logoUriTranslations$key = new ArrayList<>();
            this.logoUriTranslations$value = new ArrayList<>();
         }

         for (Entry<? extends Locale, ? extends URI> $lombokEntry : logoUriTranslations.entrySet()) {
            this.logoUriTranslations$key.add($lombokEntry.getKey());
            this.logoUriTranslations$value.add($lombokEntry.getValue());
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearLogoUriTranslations() {
         if (this.logoUriTranslations$key != null) {
            this.logoUriTranslations$key.clear();
            this.logoUriTranslations$value.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder scope(OAuth2Scope scope) {
         if (this.scopes == null) {
            this.scopes = new ArrayList<>();
         }

         this.scopes.add(scope);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder scopes(Collection<? extends OAuth2Scope> scopes) {
         if (scopes == null) {
            throw new NullPointerException("scopes cannot be null");
         }

         if (this.scopes == null) {
            this.scopes = new ArrayList<>();
         }

         this.scopes.addAll(scopes);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearScopes() {
         if (this.scopes != null) {
            this.scopes.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder contacts(List<String> contacts) {
         this.contacts = contacts;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder tosUri(Optional<URI> tosUri) {
         this.tosUri = tosUri;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder tosUriTranslation(Locale tosUriTranslationKey, URI tosUriTranslationValue) {
         if (this.tosUriTranslations$key == null) {
            this.tosUriTranslations$key = new ArrayList<>();
            this.tosUriTranslations$value = new ArrayList<>();
         }

         this.tosUriTranslations$key.add(tosUriTranslationKey);
         this.tosUriTranslations$value.add(tosUriTranslationValue);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder tosUriTranslations(Map<? extends Locale, ? extends URI> tosUriTranslations) {
         if (tosUriTranslations == null) {
            throw new NullPointerException("tosUriTranslations cannot be null");
         }

         if (this.tosUriTranslations$key == null) {
            this.tosUriTranslations$key = new ArrayList<>();
            this.tosUriTranslations$value = new ArrayList<>();
         }

         for (Entry<? extends Locale, ? extends URI> $lombokEntry : tosUriTranslations.entrySet()) {
            this.tosUriTranslations$key.add($lombokEntry.getKey());
            this.tosUriTranslations$value.add($lombokEntry.getValue());
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearTosUriTranslations() {
         if (this.tosUriTranslations$key != null) {
            this.tosUriTranslations$key.clear();
            this.tosUriTranslations$value.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder policyUri(Optional<URI> policyUri) {
         this.policyUri = policyUri;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder policyUriTranslation(
         Locale policyUriTranslationKey, URI policyUriTranslationValue
      ) {
         if (this.policyUriTranslations$key == null) {
            this.policyUriTranslations$key = new ArrayList<>();
            this.policyUriTranslations$value = new ArrayList<>();
         }

         this.policyUriTranslations$key.add(policyUriTranslationKey);
         this.policyUriTranslations$value.add(policyUriTranslationValue);
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder policyUriTranslations(Map<? extends Locale, ? extends URI> policyUriTranslations) {
         if (policyUriTranslations == null) {
            throw new NullPointerException("policyUriTranslations cannot be null");
         }

         if (this.policyUriTranslations$key == null) {
            this.policyUriTranslations$key = new ArrayList<>();
            this.policyUriTranslations$value = new ArrayList<>();
         }

         for (Entry<? extends Locale, ? extends URI> $lombokEntry : policyUriTranslations.entrySet()) {
            this.policyUriTranslations$key.add($lombokEntry.getKey());
            this.policyUriTranslations$value.add($lombokEntry.getValue());
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder clearPolicyUriTranslations() {
         if (this.policyUriTranslations$key != null) {
            this.policyUriTranslations$key.clear();
            this.policyUriTranslations$value.clear();
         }

         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder jwksUri(Optional<URI> jwksUri) {
         this.jwksUri = jwksUri;
         return this;
      }

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

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

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder mtlsCertificate(Optional<MtlsCertificate> mtlsCertificate) {
         this.mtlsCertificate = mtlsCertificate;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2TechClientMetadataImpl build() {
         Map var10 = switch (this.clientNameTranslations$key == null ? 0 : this.clientNameTranslations$key.size()) {
            case 0 -> Collections.emptyMap();
            case 1 -> Collections.singletonMap(this.clientNameTranslations$key.get(0), this.clientNameTranslations$value.get(0));
            default -> {
               Map<Locale, String> clientNameTranslations = new LinkedHashMap<>(
                  this.clientNameTranslations$key.size() < 1073741824
                     ? 1 + this.clientNameTranslations$key.size() + (this.clientNameTranslations$key.size() - 3) / 3
                     : Integer.MAX_VALUE
               );

               for (int $i = 0; $i < this.clientNameTranslations$key.size(); $i++) {
                  clientNameTranslations.put(this.clientNameTranslations$key.get($i), this.clientNameTranslations$value.get($i));
               }

               yield Collections.unmodifiableMap(clientNameTranslations);
            }
         };

         List var11 = switch (this.grantTypes == null ? 0 : this.grantTypes.size()) {
            case 0 -> Collections.emptyList();
            case 1 -> Collections.singletonList(this.grantTypes.get(0));
            default -> Collections.unmodifiableList(new ArrayList<>(this.grantTypes));
         };

         List responseTypes = switch (this.responseTypes == null ? 0 : this.responseTypes.size()) {
            case 0 -> Collections.emptyList();
            case 1 -> Collections.singletonList(this.responseTypes.get(0));
            default -> Collections.unmodifiableList(new ArrayList<>(this.responseTypes));
         };

         Map var12 = switch (this.clientUriTranslations$key == null ? 0 : this.clientUriTranslations$key.size()) {
            case 0 -> Collections.emptyMap();
            case 1 -> Collections.singletonMap(this.clientUriTranslations$key.get(0), this.clientUriTranslations$value.get(0));
            default -> {
               Map<Locale, URI> clientUriTranslations = new LinkedHashMap<>(
                  this.clientUriTranslations$key.size() < 1073741824
                     ? 1 + this.clientUriTranslations$key.size() + (this.clientUriTranslations$key.size() - 3) / 3
                     : Integer.MAX_VALUE
               );

               for (int $i = 0; $i < this.clientUriTranslations$key.size(); $i++) {
                  clientUriTranslations.put(this.clientUriTranslations$key.get($i), this.clientUriTranslations$value.get($i));
               }

               yield Collections.unmodifiableMap(clientUriTranslations);
            }
         };

         Map var14 = switch (this.logoUriTranslations$key == null ? 0 : this.logoUriTranslations$key.size()) {
            case 0 -> Collections.emptyMap();
            case 1 -> Collections.singletonMap(this.logoUriTranslations$key.get(0), this.logoUriTranslations$value.get(0));
            default -> {
               Map<Locale, URI> logoUriTranslations = new LinkedHashMap<>(
                  this.logoUriTranslations$key.size() < 1073741824
                     ? 1 + this.logoUriTranslations$key.size() + (this.logoUriTranslations$key.size() - 3) / 3
                     : Integer.MAX_VALUE
               );

               for (int $i = 0; $i < this.logoUriTranslations$key.size(); $i++) {
                  logoUriTranslations.put(this.logoUriTranslations$key.get($i), this.logoUriTranslations$value.get($i));
               }

               yield Collections.unmodifiableMap(logoUriTranslations);
            }
         };

         List var15 = switch (this.scopes == null ? 0 : this.scopes.size()) {
            case 0 -> Collections.emptyList();
            case 1 -> Collections.singletonList(this.scopes.get(0));
            default -> Collections.unmodifiableList(new ArrayList<>(this.scopes));
         };

         Map var16 = switch (this.tosUriTranslations$key == null ? 0 : this.tosUriTranslations$key.size()) {
            case 0 -> Collections.emptyMap();
            case 1 -> Collections.singletonMap(this.tosUriTranslations$key.get(0), this.tosUriTranslations$value.get(0));
            default -> {
               Map<Locale, URI> tosUriTranslations = new LinkedHashMap<>(
                  this.tosUriTranslations$key.size() < 1073741824
                     ? 1 + this.tosUriTranslations$key.size() + (this.tosUriTranslations$key.size() - 3) / 3
                     : Integer.MAX_VALUE
               );

               for (int $i = 0; $i < this.tosUriTranslations$key.size(); $i++) {
                  tosUriTranslations.put(this.tosUriTranslations$key.get($i), this.tosUriTranslations$value.get($i));
               }

               yield Collections.unmodifiableMap(tosUriTranslations);
            }
         };

         return new OAuth2TechClientMetadataImpl(
            this.clientId,
            this.authorizationServerId,
            this.clientSecret,
            this.clientName,
            var10,
            this.clientIdIssuedAt,
            this.redirectUris,
            this.tokenEndpointAuthMethod,
            var11,
            responseTypes,
            this.clientUri,
            var12,
            this.logoUri,
            var14,
            var15,
            this.contacts,
            this.tosUri,
            var16,
            this.policyUri,
            switch (this.policyUriTranslations$key == null ? 0 : this.policyUriTranslations$key.size()) {
               case 0 -> Collections.emptyMap();
               case 1 -> Collections.singletonMap(this.policyUriTranslations$key.get(0), this.policyUriTranslations$value.get(0));
               default -> {
                  Map<Locale, URI> policyUriTranslations = new LinkedHashMap<>(
                     this.policyUriTranslations$key.size() < 1073741824
                        ? 1 + this.policyUriTranslations$key.size() + (this.policyUriTranslations$key.size() - 3) / 3
                        : Integer.MAX_VALUE
                  );

                  for (int $i = 0; $i < this.policyUriTranslations$key.size(); $i++) {
                     policyUriTranslations.put(this.policyUriTranslations$key.get($i), this.policyUriTranslations$value.get($i));
                  }

                  yield Collections.unmodifiableMap(policyUriTranslations);
               }
            },
            this.jwksUri,
            this.softwareId,
            this.softwareVersion,
            this.mtlsCertificate
         );
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "OAuth2TechClientMetadataImpl.OAuth2TechClientMetadataImplBuilder(clientId="
            + this.clientId
            + ", authorizationServerId="
            + this.authorizationServerId
            + ", clientSecret="
            + this.clientSecret
            + ", clientName="
            + this.clientName
            + ", clientNameTranslations$key="
            + this.clientNameTranslations$key
            + ", clientNameTranslations$value="
            + this.clientNameTranslations$value
            + ", clientIdIssuedAt="
            + this.clientIdIssuedAt
            + ", redirectUris="
            + this.redirectUris
            + ", tokenEndpointAuthMethod="
            + this.tokenEndpointAuthMethod
            + ", grantTypes="
            + this.grantTypes
            + ", responseTypes="
            + this.responseTypes
            + ", clientUri="
            + this.clientUri
            + ", clientUriTranslations$key="
            + this.clientUriTranslations$key
            + ", clientUriTranslations$value="
            + this.clientUriTranslations$value
            + ", logoUri="
            + this.logoUri
            + ", logoUriTranslations$key="
            + this.logoUriTranslations$key
            + ", logoUriTranslations$value="
            + this.logoUriTranslations$value
            + ", scopes="
            + this.scopes
            + ", contacts="
            + this.contacts
            + ", tosUri="
            + this.tosUri
            + ", tosUriTranslations$key="
            + this.tosUriTranslations$key
            + ", tosUriTranslations$value="
            + this.tosUriTranslations$value
            + ", policyUri="
            + this.policyUri
            + ", policyUriTranslations$key="
            + this.policyUriTranslations$key
            + ", policyUriTranslations$value="
            + this.policyUriTranslations$value
            + ", jwksUri="
            + this.jwksUri
            + ", softwareId="
            + this.softwareId
            + ", softwareVersion="
            + this.softwareVersion
            + ", mtlsCertificate="
            + this.mtlsCertificate
            + ")";
      }
   }
}
