package com.airlock.iam.admin.application.configuration.realm;

import com.airlock.iam.common.application.configuration.user.UserProfileValueProviderConfig;
import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.license.PluginLicenseRestriction;
import com.airlock.iam.plugin.api.annotation.property.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@Plugin(description = "Provides a value based on the administrator's realm.", displayName = "Realm Value Provider")
@PluginLicenseRestriction(moduleAffiliation = "RealmAdministration")
public final class RealmValueProviderConfig implements UserProfileValueProviderConfig {
   public static final String REALM_PLACEHOLDER = "@realm@";
   @StringProperty(
      description = "The value that is provided by this plugin. Use the placeholder <tt>@realm@</tt> where the current administrator's realm is expected.<p>Note that if the realm of an administrator cannot be determined, an empty string is provided independent of the configured value.</p>",
      exampleValues = {"@realm@_", "@realm@-"},
      optional = false
   )
   private String value;

   public String getValue() {
      return this.value;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public RealmValueProviderConfig(String value) {
      this.value = value;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class RealmValueProviderConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String value;

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

      @SuppressFBWarnings(justification = "generated code")
      public RealmValueProviderConfig.RealmValueProviderConfigBuilder value(String value) {
         this.value = value;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public RealmValueProviderConfig build() {
         return new RealmValueProviderConfig(this.value);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "RealmValueProviderConfig.RealmValueProviderConfigBuilder(value=" + this.value + ")";
      }
   }
}
