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

import com.airlock.iam.common.application.configuration.event.LoginappSubscribedEventConfig;
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, independent of whether the user has been identified or not 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 do not need user data (e.g. user ID, context data) to be present for their event handling.\nFor example an E-Mail Event Subscriber with a static recipient address.</p><p>In case user data is required for the event handling, the \"Generic Step Result With Identified User\" plugin should be used.</p>",
   displayName = "Generic Step Result"
)
public final class GenericStepResultSubscribedEventConfig extends CommonGenericStepResultSubscribedEventConfig implements LoginappSubscribedEventConfig {
   public static final String GENERIC_STEP_RESULT_PLUGIN_NAME = "Generic Step Result";

   public GenericStepResultSubscribedEventConfig(
      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 GenericStepResultSubscribedEventConfig.GenericStepResultSubscribedEventConfigBuilder builder() {
      return new GenericStepResultSubscribedEventConfig.GenericStepResultSubscribedEventConfigBuilder();
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public static class GenericStepResultSubscribedEventConfigBuilder {
      @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")
      GenericStepResultSubscribedEventConfigBuilder() {
      }

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

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

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

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

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

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

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

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