package com.airlock.iam.application.parameters.domain.model;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;

public final class ApplicationParameters {
   private final String info;
   private final GlobalParameters global;
   private final LogParameters log;
   private final WebServerParameters webServer;
   private final H2Parameters h2;
   private final HealthCheckParameters healthCheck;
   private final AdminappParameters adminapp;
   private final LoginappParameters loginapp;
   private final TransactionApprovalParameters transactionApproval;
   private final ApiPolicyServiceParameters apiPolicyService;
   private final ServiceContainerParameters serviceContainer;
   private final ClientSslConnectionParameters clientSslConnectionParameters;
   private final MetricsParameters metricsParameters;

   public ApplicationParameters(
      String info,
      GlobalParameters global,
      LogParameters log,
      WebServerParameters webServer,
      HealthCheckParameters healthCheck,
      H2Parameters h2,
      AdminappParameters adminapp,
      LoginappParameters loginapp,
      TransactionApprovalParameters transactionApproval,
      ApiPolicyServiceParameters apiPolicyService,
      ServiceContainerParameters serviceContainer,
      ClientSslConnectionParameters clientSslConnectionParameters,
      MetricsParameters metricsParameters
   ) {
      this.info = Objects.requireNonNull(info);
      this.global = Objects.requireNonNull(global);
      this.log = Objects.requireNonNull(log);
      this.webServer = Objects.requireNonNull(webServer);
      this.healthCheck = Objects.requireNonNull(healthCheck);
      this.h2 = h2;
      this.adminapp = adminapp;
      this.loginapp = loginapp;
      this.transactionApproval = transactionApproval;
      this.apiPolicyService = apiPolicyService;
      this.serviceContainer = serviceContainer;
      this.clientSslConnectionParameters = Objects.requireNonNull(clientSslConnectionParameters);
      this.metricsParameters = metricsParameters;
   }

   public HealthCheckParameters healthCheck() {
      return this.healthCheck;
   }

   public Optional<H2Parameters> h2() {
      return Optional.ofNullable(this.h2);
   }

   public Optional<AdminappParameters> adminapp() {
      return Optional.ofNullable(this.adminapp);
   }

   public Optional<LoginappParameters> loginapp() {
      return Optional.ofNullable(this.loginapp);
   }

   public Optional<TransactionApprovalParameters> transactionApproval() {
      return Optional.ofNullable(this.transactionApproval);
   }

   public Optional<ApiPolicyServiceParameters> apiPolicyService() {
      return Optional.ofNullable(this.apiPolicyService);
   }

   public Optional<ServiceContainerParameters> serviceContainer() {
      return Optional.ofNullable(this.serviceContainer);
   }

   public Stream<? extends WebAppParameters> webAppParameters() {
      return Stream.of(this.adminapp(), this.loginapp(), this.transactionApproval(), this.apiPolicyService(), this.serviceContainer())
         .flatMap(Optional::stream);
   }

   @Override
   public String toString() {
      return this.info;
   }

   public Optional<MetricsParameters> metrics() {
      return Optional.ofNullable(this.metricsParameters);
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public GlobalParameters global() {
      return this.global;
   }

   @SuppressFBWarnings(justification = "generated code")
   public LogParameters log() {
      return this.log;
   }

   @SuppressFBWarnings(justification = "generated code")
   public WebServerParameters webServer() {
      return this.webServer;
   }

   @SuppressFBWarnings(justification = "generated code")
   public ClientSslConnectionParameters clientSslConnectionParameters() {
      return this.clientSslConnectionParameters;
   }

   @SuppressFBWarnings(justification = "generated code")
   public MetricsParameters metricsParameters() {
      return this.metricsParameters;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof ApplicationParameters other)) {
         return false;
      } else {
         Object this$info = this.info;
         Object other$info = other.info;
         if (this$info == null ? other$info == null : this$info.equals(other$info)) {
            Object this$global = this.global;
            Object other$global = other.global;
            if (this$global == null ? other$global == null : this$global.equals(other$global)) {
               Object this$log = this.log;
               Object other$log = other.log;
               if (this$log == null ? other$log == null : this$log.equals(other$log)) {
                  Object this$webServer = this.webServer;
                  Object other$webServer = other.webServer;
                  if (this$webServer == null ? other$webServer == null : this$webServer.equals(other$webServer)) {
                     Object this$h2 = this.h2;
                     Object other$h2 = other.h2;
                     if (this$h2 == null ? other$h2 == null : this$h2.equals(other$h2)) {
                        Object this$healthCheck = this.healthCheck;
                        Object other$healthCheck = other.healthCheck;
                        if (this$healthCheck == null ? other$healthCheck == null : this$healthCheck.equals(other$healthCheck)) {
                           Object this$adminapp = this.adminapp;
                           Object other$adminapp = other.adminapp;
                           if (this$adminapp == null ? other$adminapp == null : this$adminapp.equals(other$adminapp)) {
                              Object this$loginapp = this.loginapp;
                              Object other$loginapp = other.loginapp;
                              if (this$loginapp == null ? other$loginapp == null : this$loginapp.equals(other$loginapp)) {
                                 Object this$transactionApproval = this.transactionApproval;
                                 Object other$transactionApproval = other.transactionApproval;
                                 if (this$transactionApproval == null
                                    ? other$transactionApproval == null
                                    : this$transactionApproval.equals(other$transactionApproval)) {
                                    Object this$apiPolicyService = this.apiPolicyService;
                                    Object other$apiPolicyService = other.apiPolicyService;
                                    if (this$apiPolicyService == null ? other$apiPolicyService == null : this$apiPolicyService.equals(other$apiPolicyService)) {
                                       Object this$serviceContainer = this.serviceContainer;
                                       Object other$serviceContainer = other.serviceContainer;
                                       if (this$serviceContainer == null
                                          ? other$serviceContainer == null
                                          : this$serviceContainer.equals(other$serviceContainer)) {
                                          Object this$clientSslConnectionParameters = this.clientSslConnectionParameters;
                                          Object other$clientSslConnectionParameters = other.clientSslConnectionParameters;
                                          if (this$clientSslConnectionParameters == null
                                             ? other$clientSslConnectionParameters == null
                                             : this$clientSslConnectionParameters.equals(other$clientSslConnectionParameters)) {
                                             Object this$metricsParameters = this.metricsParameters;
                                             Object other$metricsParameters = other.metricsParameters;
                                             return this$metricsParameters == null
                                                ? other$metricsParameters == null
                                                : this$metricsParameters.equals(other$metricsParameters);
                                          } 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 $info = this.info;
      result = result * 59 + ($info == null ? 43 : $info.hashCode());
      Object $global = this.global;
      result = result * 59 + ($global == null ? 43 : $global.hashCode());
      Object $log = this.log;
      result = result * 59 + ($log == null ? 43 : $log.hashCode());
      Object $webServer = this.webServer;
      result = result * 59 + ($webServer == null ? 43 : $webServer.hashCode());
      Object $h2 = this.h2;
      result = result * 59 + ($h2 == null ? 43 : $h2.hashCode());
      Object $healthCheck = this.healthCheck;
      result = result * 59 + ($healthCheck == null ? 43 : $healthCheck.hashCode());
      Object $adminapp = this.adminapp;
      result = result * 59 + ($adminapp == null ? 43 : $adminapp.hashCode());
      Object $loginapp = this.loginapp;
      result = result * 59 + ($loginapp == null ? 43 : $loginapp.hashCode());
      Object $transactionApproval = this.transactionApproval;
      result = result * 59 + ($transactionApproval == null ? 43 : $transactionApproval.hashCode());
      Object $apiPolicyService = this.apiPolicyService;
      result = result * 59 + ($apiPolicyService == null ? 43 : $apiPolicyService.hashCode());
      Object $serviceContainer = this.serviceContainer;
      result = result * 59 + ($serviceContainer == null ? 43 : $serviceContainer.hashCode());
      Object $clientSslConnectionParameters = this.clientSslConnectionParameters;
      result = result * 59 + ($clientSslConnectionParameters == null ? 43 : $clientSslConnectionParameters.hashCode());
      Object $metricsParameters = this.metricsParameters;
      return result * 59 + ($metricsParameters == null ? 43 : $metricsParameters.hashCode());
   }
}
