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

import com.airlock.iam.common.application.configuration.event.EventReadyValueMapProviderConfig;
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 some login statistics of the user.</p><p>Currently, the following values are provided:<ul><li><b>latest-successful-login</b>: date of the latest successful login (if available).</li><li><b>second-latest-successful-login</b>: date of the second-latest successful login (if available).</li><li><b>total-logins</b>: total number of successful logins.</li><li><b>failed-logins</b>: number of failed login attempts since the latest successful login.</li><li><b>latest-login-attempt</b>: date of the latest login attempt (successful or not, if available).</li><li><b>first-login</b>: date of the first ever successful login (if available).</li><li><b>self-registration-date</b>: date of the self-registration (if available).</li><li><b>lock-date</b>: date when the user was locked (if available).</li><li><b>latest-unlock-attempt</b>: date of the latest unlock attempt (if available).</li><li><b>unlock-attempts</b>: number of unlock attempts.</li><li><b>lock-reason</b>: reason for locking the user (if available).</li><li><b>self-registered</b>: whether the user is self-registered.</li><li><b>locked</b>: whether the user is locked.</li><li><b>valid</b>: whether the user is valid.</li><li><b>valid-from</b>: date from which the user is valid (if available).</li><li><b>valid-to</b>: date until which the user is valid (if available).</li></ul></p>",
   displayName = "User Statistics Map"
)
public class UserStatisticsValueMapProviderConfig implements ValueMapProviderConfig, EventReadyValueMapProviderConfig {
   public static final String USER_STATS_MAP_PROVIDER_DISPLAY_NAME = "User Statistics Map";
   public static final String LATEST_SUCCESSFUL_LOGIN_KEY = "latest-successful-login";
   public static final String SECOND_LATEST_SUCCESSFUL_LOGIN_KEY = "second-latest-successful-login";
   public static final String TOTAL_LOGINS_KEY = "total-logins";
   public static final String FIRST_LOGIN_KEY = "first-login";
   public static final String LATEST_LOGIN_ATTEMPT_KEY = "latest-login-attempt";
   public static final String FAILED_LOGINS_KEY = "failed-logins";
   public static final String SELF_REGISTRATION_DATE_KEY = "self-registration-date";
   public static final String LOCK_DATE_KEY = "lock-date";
   public static final String LATEST_UNLOCK_ATTEMPT_KEY = "latest-unlock-attempt";
   public static final String UNLOCK_ATTEMPTS_KEY = "unlock-attempts";
   public static final String LOCK_REASON_KEY = "lock-reason";
   public static final String SELF_REGISTERED_KEY = "self-registered";
   public static final String LOCKED_KEY = "locked";
   public static final String VALID_KEY = "valid";
   public static final String VALID_FROM_KEY = "valid-from";
   public static final String VALID_TO_KEY = "valid-to";

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

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

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

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