package com.airlock.iam.admin.application.configuration.generic.ui;

import com.airlock.iam.admin.domain.model.token.generic.MessageUiElementType;
import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.property.EnumProperty;
import com.airlock.iam.plugin.api.annotation.property.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(description = "Renders a full-width message with static text.", displayName = "Text Message Token Controller Element")
public final class TextMessageTokenControllerUiElementConfig implements TokenControllerUiElementConfig {
   @StringProperty(
      description = "The message is interpreted as translation key.\nIf no translation is found, the message is displayed as configured.",
      optional = false
   )
   private String message;
   @EnumProperty(
      description = "Defines how the message is displayed.\n<ul>\n<li><code>Paragraph</code>: text is displayed without any style.</li>\n<li><code>Header</code>: bold text with margins around to separate it from other elements.</li>\n<li><code>Info</code>: text in a blue box.</li>\n<li><code>Warning</code>: text in a yellow box.</li>\n<li><code>Error</code>: text in a red box.</li>\n</ul>",
      defaultValue = "PARAGRAPH",
      optional = true
   )
   private MessageUiElementType type;

   public String getMessage() {
      return this.message;
   }

   public MessageUiElementType getType() {
      return this.type;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public TextMessageTokenControllerUiElementConfig(String message, MessageUiElementType type) {
      this.message = message;
      this.type = type;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class TextMessageTokenControllerUiElementConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String message;
      @SuppressFBWarnings(justification = "generated code")
      private MessageUiElementType type;

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

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

      @SuppressFBWarnings(justification = "generated code")
      public TextMessageTokenControllerUiElementConfig.TextMessageTokenControllerUiElementConfigBuilder type(MessageUiElementType type) {
         this.type = type;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public TextMessageTokenControllerUiElementConfig build() {
         return new TextMessageTokenControllerUiElementConfig(this.message, this.type);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "TextMessageTokenControllerUiElementConfig.TextMessageTokenControllerUiElementConfigBuilder(message="
            + this.message
            + ", type="
            + this.type
            + ")";
      }
   }
}
