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

import com.airlock.iam.common.application.configuration.security.StorageEncryptionConfig;
import com.airlock.iam.core.misc.persistency.SqlDataSource;
import com.airlock.iam.database.infrastructure.TenantId;
import com.airlock.iam.security.util.crypto.StringCipher;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public final class TechClientRepositorySettings {
   private final SqlDataSource dataSource;
   private final boolean logQueries;
   private final TenantId tenantId;
   private final StringCipher cipher;
   private final StorageEncryptionConfig storageEncryption;

   @SuppressFBWarnings(justification = "generated code")
   TechClientRepositorySettings(SqlDataSource dataSource, boolean logQueries, TenantId tenantId, StringCipher cipher, StorageEncryptionConfig storageEncryption) {
      this.dataSource = dataSource;
      this.logQueries = logQueries;
      this.tenantId = tenantId;
      this.cipher = cipher;
      this.storageEncryption = storageEncryption;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public SqlDataSource getDataSource() {
      return this.dataSource;
   }

   @SuppressFBWarnings(justification = "generated code")
   public boolean isLogQueries() {
      return this.logQueries;
   }

   @SuppressFBWarnings(justification = "generated code")
   public TenantId getTenantId() {
      return this.tenantId;
   }

   @SuppressFBWarnings(justification = "generated code")
   public StringCipher getCipher() {
      return this.cipher;
   }

   @SuppressFBWarnings(justification = "generated code")
   public StorageEncryptionConfig getStorageEncryption() {
      return this.storageEncryption;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof TechClientRepositorySettings other)) {
         return false;
      } else {
         if (this.logQueries != other.logQueries) {
            return false;
         }

         Object this$dataSource = this.dataSource;
         Object other$dataSource = other.dataSource;
         if (this$dataSource == null ? other$dataSource == null : this$dataSource.equals(other$dataSource)) {
            Object this$tenantId = this.tenantId;
            Object other$tenantId = other.tenantId;
            if (this$tenantId == null ? other$tenantId == null : this$tenantId.equals(other$tenantId)) {
               Object this$cipher = this.cipher;
               Object other$cipher = other.cipher;
               if (this$cipher == null ? other$cipher == null : this$cipher.equals(other$cipher)) {
                  Object this$storageEncryption = this.storageEncryption;
                  Object other$storageEncryption = other.storageEncryption;
                  return this$storageEncryption == null ? other$storageEncryption == null : this$storageEncryption.equals(other$storageEncryption);
               } else {
                  return false;
               }
            } else {
               return false;
            }
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      result = result * 59 + (this.logQueries ? 79 : 97);
      Object $dataSource = this.dataSource;
      result = result * 59 + ($dataSource == null ? 43 : $dataSource.hashCode());
      Object $tenantId = this.tenantId;
      result = result * 59 + ($tenantId == null ? 43 : $tenantId.hashCode());
      Object $cipher = this.cipher;
      result = result * 59 + ($cipher == null ? 43 : $cipher.hashCode());
      Object $storageEncryption = this.storageEncryption;
      return result * 59 + ($storageEncryption == null ? 43 : $storageEncryption.hashCode());
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "TechClientRepositorySettings(dataSource="
         + this.getDataSource()
         + ", logQueries="
         + this.isLogQueries()
         + ", tenantId="
         + this.getTenantId()
         + ", cipher="
         + this.getCipher()
         + ", storageEncryption="
         + this.getStorageEncryption()
         + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class TechClientRepositorySettingsBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private SqlDataSource dataSource;
      @SuppressFBWarnings(justification = "generated code")
      private boolean logQueries;
      @SuppressFBWarnings(justification = "generated code")
      private TenantId tenantId;
      @SuppressFBWarnings(justification = "generated code")
      private StringCipher cipher;
      @SuppressFBWarnings(justification = "generated code")
      private StorageEncryptionConfig storageEncryption;

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

      @SuppressFBWarnings(justification = "generated code")
      public TechClientRepositorySettings.TechClientRepositorySettingsBuilder dataSource(SqlDataSource dataSource) {
         this.dataSource = dataSource;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TechClientRepositorySettings.TechClientRepositorySettingsBuilder logQueries(boolean logQueries) {
         this.logQueries = logQueries;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TechClientRepositorySettings.TechClientRepositorySettingsBuilder tenantId(TenantId tenantId) {
         this.tenantId = tenantId;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TechClientRepositorySettings.TechClientRepositorySettingsBuilder cipher(StringCipher cipher) {
         this.cipher = cipher;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TechClientRepositorySettings.TechClientRepositorySettingsBuilder storageEncryption(StorageEncryptionConfig storageEncryption) {
         this.storageEncryption = storageEncryption;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TechClientRepositorySettings build() {
         return new TechClientRepositorySettings(this.dataSource, this.logQueries, this.tenantId, this.cipher, this.storageEncryption);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "TechClientRepositorySettings.TechClientRepositorySettingsBuilder(dataSource="
            + this.dataSource
            + ", logQueries="
            + this.logQueries
            + ", tenantId="
            + this.tenantId
            + ", cipher="
            + this.cipher
            + ", storageEncryption="
            + this.storageEncryption
            + ")";
      }
   }
}
