package com.airlock.iam.ssi.application.configuration;

import com.airlock.iam.plugin.api.annotation.config.Plugin;
import com.airlock.iam.plugin.api.annotation.property.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import jakarta.annotation.Nullable;

@Plugin(description = "Represents an attribute to be requested from the user.", displayName = "SSI Attribute")
public final class SsiAttributeConfig {
   @StringProperty(description = "Name of the attribute as it appears in the schema.", exampleValues = "firstName", optional = false)
   private String name;
   @StringProperty(
      description = "The key which can be used for obtaining the attribute value from the SSI Verification Data Provider. If omitted, the attribute name will be used as the key.",
      exampleValues = "givenName",
      optional = true
   )
   private String providerKey;

   public String getName() {
      return this.name;
   }

   @Nullable
   public String getProviderKey() {
      return this.providerKey;
   }

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

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

   @SuppressFBWarnings(justification = "generated code")
   public SsiAttributeConfig(String name, String providerKey) {
      this.name = name;
      this.providerKey = providerKey;
   }

   @SuppressFBWarnings(justification = "generated code")
   public static class SsiAttributeConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private String name;
      @SuppressFBWarnings(justification = "generated code")
      private String providerKey;

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

      @SuppressFBWarnings(justification = "generated code")
      public SsiAttributeConfig.SsiAttributeConfigBuilder name(String name) {
         this.name = name;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SsiAttributeConfig.SsiAttributeConfigBuilder providerKey(String providerKey) {
         this.providerKey = providerKey;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public SsiAttributeConfig build() {
         return new SsiAttributeConfig(this.name, this.providerKey);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "SsiAttributeConfig.SsiAttributeConfigBuilder(name=" + this.name + ", providerKey=" + this.providerKey + ")";
      }
   }
}
