package com.airlock.iam.common.application.configuration.termsofservice;

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.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(description = "Defines a language-dependent, formatted disclaimer text displayed to the user.")
@PluginLicenseRestriction(moduleAffiliation = "TermsOfServices")
public class DisclaimerTextConfig {
   @StringProperty(
      description = "The two-letter ISO code of the display language this text should be used for. It must correspond to one of the configured login application languages.",
      suggestedValues = {"de", "en", "fr", "it", "es"},
      optional = false
   )
   private String language;
   public static final String LANGUAGE_FIELD = "language";
   @StringProperty(description = "The text to be displayed (may contain HTML markup code).", isMultiLineText = true, optional = false)
   private String text;

   public String getLanguage() {
      return this.language;
   }

   public String getText() {
      return this.text;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public DisclaimerTextConfig(String language, String text) {
      this.language = language;
      this.text = text;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class DisclaimerTextConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String language;
      @SuppressFBWarnings(justification = "generated code")
      private String text;

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

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

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

      @SuppressFBWarnings(justification = "generated code")
      public DisclaimerTextConfig build() {
         return new DisclaimerTextConfig(this.language, this.text);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "DisclaimerTextConfig.DisclaimerTextConfigBuilder(language=" + this.language + ", text=" + this.text + ")";
      }
   }
}
