package com.airlock.iam.flow.shared.application.configuration.valueprovider;

import com.airlock.iam.flow.api.application.configuration.valueprovider.ValueMapProviderConfig;
import com.airlock.iam.plugin.api.annotation.config.Plugin;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(
   description = "<p>Provides values for various mTAN token-related use cases. The values are retrieved from the flow session and provided by this plugin to be used in an approval step.</p><p>The following example use case illustrates how this provider can be used: <ol><li>User opens mTAN self-services.</li><li>User selects a device.</li><li>User changes the number.</li><li>User verifies the new number by entering a received SMS OTP.</li><li>User approves the number change by accepting a push sent to an Airlock 2FA device (where this provider comes in handy).</li></ol></p><p>Values provided by this plugin, grouped by the use cases:<ul><li><b>Registering an mTAN token</b> (typically using the \"mTAN Token Registration Step\"): Provides the new phone number and label.<ul><li><b>new-mtan-phone-number</b>: The new phone number.</li><li><b>new-mtan-label</b>: The optional new label. Not provided if no label is used.</li></ul></li><li><b>Editing an mTAN token</b> (typically using the \"mTAN Token Edit Step\"): Provides the old and new phone number and label.<ul><li><b>old-mtan-phone-number</b>: The old phone number.</li><li><b>old-mtan-label</b>: The optional old label. Not provided if no label was set.</li><li><b>new-mtan-phone-number</b>: The new phone number. If the number was not changed, the old phone number is provided.</li><li><b>new-mtan-label</b>: The optional new label. Not provided if the label was removed or there is no old label and no label was set. If the label was not changed, the old label is provided.</li></ul></li><li><b>Deleting an mTAN token</b> (typically using the \"Delete mTAN Number Initiation Step\"): Provides the phone number and label of the token to be deleted.<ul><li><b>deleted-mtan-phone-number</b>: The phone number of the deleted token.</li><li><b>deleted-mtan-label</b>: The optional label of the deleted token.</li></ul></li><li><b>Selecting an mTAN token</b> (typically using the \"Select mTAN Token Step\" and most often used in combination with the mTAN token edit use case): Provides the phone number and label of a selected token. If used in combination with the mTAN token edit use case, the values will be equal to the old mTAN number and old mTAN label.<ul><li><b>selected-mtan-phone-number</b>: The phone number of the selected token.</li><li><b>selected-mtan-label</b>: The optional label of the selected token.</li></ul></li></ul></p>",
   displayName = "mTAN Token Flow Value Map"
)
public final class MtanTokenFlowValueMapProviderConfig implements ValueMapProviderConfig {
   public static final String SELECTED_MTAN_NUMBER_KEY = "selected-mtan-phone-number";
   public static final String SELECTED_MTAN_LABEL_KEY = "selected-mtan-label";
   public static final String OLD_MTAN_NUMBER_KEY = "old-mtan-phone-number";
   public static final String OLD_MTAN_LABEL_KEY = "old-mtan-label";
   public static final String NEW_MTAN_NUMBER_KEY = "new-mtan-phone-number";
   public static final String NEW_MTAN_LABEL_KEY = "new-mtan-label";
   public static final String DELETED_MTAN_NUMBER_KEY = "deleted-mtan-phone-number";
   public static final String DELETED_MTAN_LABEL_KEY = "deleted-mtan-label";

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

   @SuppressFBWarnings(justification = "generated code")
   public static class MtanTokenFlowValueMapProviderConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      MtanTokenFlowValueMapProviderConfigBuilder() {
      }

      @SuppressFBWarnings(justification = "generated code")
      public MtanTokenFlowValueMapProviderConfig build() {
         return new MtanTokenFlowValueMapProviderConfig();
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "MtanTokenFlowValueMapProviderConfig.MtanTokenFlowValueMapProviderConfigBuilder()";
      }
   }
}
