package com.airlock.iam.login.application.configuration.event;

import com.airlock.iam.common.application.configuration.event.LoginappUserSubscribedEventConfig;
import com.airlock.iam.plugin.api.annotation.config.Plugin;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.regex.Pattern;

@Plugin(
   description = "<p>Event that is published with every step result during flows, only in case the user has been identified at event creation time.</p>\n<p>All configured filters must apply (\"AND\" logic). To achieve \"OR\" logic, multiple subscribers can be configured.</p>\n<p>This plugin is useful for subscribers which require user data (e.g. user ID, contextData) to be present for their event handling.\nFor example an SMS Event Subscriber sending an SMS to the user's phone number.</p><p>In case user data is NOT required for the event handling, the \"Generic Step Result\" plugin can be used.</p>",
   displayName = "Generic Step Result With Identified User"
)
public final class GenericStepResultWithUserSubscribedEventConfig
   extends CommonGenericStepResultSubscribedEventConfig
   implements LoginappUserSubscribedEventConfig {
   public static final String GENERIC_STEP_RESULT_WITH_IDENTIFIED_USER_PLUGIN_NAME = "Generic Step Result With Identified User";

   public GenericStepResultWithUserSubscribedEventConfig(
      Pattern stepIdFilter, Pattern flowIdFilter, String flowTypeFilter, String resultTypeFilter, Pattern nextActionFilter, Pattern errorCodeFilter
   ) {
      super(stepIdFilter, flowIdFilter, flowTypeFilter, resultTypeFilter, nextActionFilter, errorCodeFilter);
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public static class GenericStepResultWithUserSubscribedEventConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private Pattern stepIdFilter;
      @SuppressFBWarnings(justification = "generated code")
      private Pattern flowIdFilter;
      @SuppressFBWarnings(justification = "generated code")
      private String flowTypeFilter;
      @SuppressFBWarnings(justification = "generated code")
      private String resultTypeFilter;
      @SuppressFBWarnings(justification = "generated code")
      private Pattern nextActionFilter;
      @SuppressFBWarnings(justification = "generated code")
      private Pattern errorCodeFilter;

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

      @SuppressFBWarnings(justification = "generated code")
      public GenericStepResultWithUserSubscribedEventConfig.GenericStepResultWithUserSubscribedEventConfigBuilder stepIdFilter(Pattern stepIdFilter) {
         this.stepIdFilter = stepIdFilter;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public GenericStepResultWithUserSubscribedEventConfig.GenericStepResultWithUserSubscribedEventConfigBuilder flowIdFilter(Pattern flowIdFilter) {
         this.flowIdFilter = flowIdFilter;
         return this;
      }

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

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

      @SuppressFBWarnings(justification = "generated code")
      public GenericStepResultWithUserSubscribedEventConfig.GenericStepResultWithUserSubscribedEventConfigBuilder nextActionFilter(Pattern nextActionFilter) {
         this.nextActionFilter = nextActionFilter;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public GenericStepResultWithUserSubscribedEventConfig.GenericStepResultWithUserSubscribedEventConfigBuilder errorCodeFilter(Pattern errorCodeFilter) {
         this.errorCodeFilter = errorCodeFilter;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public GenericStepResultWithUserSubscribedEventConfig build() {
         return new GenericStepResultWithUserSubscribedEventConfig(
            this.stepIdFilter, this.flowIdFilter, this.flowTypeFilter, this.resultTypeFilter, this.nextActionFilter, this.errorCodeFilter
         );
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "GenericStepResultWithUserSubscribedEventConfig.GenericStepResultWithUserSubscribedEventConfigBuilder(stepIdFilter="
            + this.stepIdFilter
            + ", flowIdFilter="
            + this.flowIdFilter
            + ", flowTypeFilter="
            + this.flowTypeFilter
            + ", resultTypeFilter="
            + this.resultTypeFilter
            + ", nextActionFilter="
            + this.nextActionFilter
            + ", errorCodeFilter="
            + this.errorCodeFilter
            + ")";
      }
   }
}
