package com.airlock.iam.admin.application.configuration.techclients;

import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.license.PluginLicenseRestriction;
import com.airlock.iam.plugin.api.annotation.property.PluginListProperty;
import com.airlock.iam.plugin.api.annotation.property.PluginProperty;
import com.airlock.iam.techclient.api.application.configuration.TechnicalClientInterceptorConfig;
import com.airlock.iam.techclient.application.configuration.TechClientRepositoryConfig;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.List;

@Plugin(description = "Configuration for managing technical clients.", displayName = "Technical Clients Settings")
@PluginLicenseRestriction(moduleAffiliation = "TechClients")
public final class TechClientsConfig {
   @PluginProperty(description = "A repository that allows to configure the DB access concerning technical clients.", optional = false)
   private TechClientRepositoryConfig repository;
   @PluginListProperty(
      displayName = "Technical Client Interceptors",
      description = "Defines interceptors that get notified upon changes on technical clients.",
      optional = true
   )
   private List<TechnicalClientInterceptorConfig> interceptors;

   public TechClientRepositoryConfig getRepository() {
      return this.repository;
   }

   public List<TechnicalClientInterceptorConfig> getInterceptors() {
      return this.interceptors;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public TechClientsConfig() {
   }

   @SuppressFBWarnings(justification = "generated code")
   public TechClientsConfig(TechClientRepositoryConfig repository, List<TechnicalClientInterceptorConfig> interceptors) {
      this.repository = repository;
      this.interceptors = interceptors;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class TechClientsConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private TechClientRepositoryConfig repository;
      @SuppressFBWarnings(justification = "generated code")
      private List<TechnicalClientInterceptorConfig> interceptors;

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

      @SuppressFBWarnings(justification = "generated code")
      public TechClientsConfig.TechClientsConfigBuilder repository(TechClientRepositoryConfig repository) {
         this.repository = repository;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TechClientsConfig.TechClientsConfigBuilder interceptors(List<TechnicalClientInterceptorConfig> interceptors) {
         this.interceptors = interceptors;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TechClientsConfig build() {
         return new TechClientsConfig(this.repository, this.interceptors);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "TechClientsConfig.TechClientsConfigBuilder(repository=" + this.repository + ", interceptors=" + this.interceptors + ")";
      }
   }
}
