package com.airlock.iam.oauth2.application.configuration.claims;

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.StringListProperty;
import com.airlock.iam.plugin.api.annotation.property.StringProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.List;

@Plugin(
   description = "<p>Distributed Claims provide a way to include static references to claims held by 3rd party claims providers.</p><p>The client may then fetch those claims using the given URL from the claims providers.</p><p>Supplying an 'access_token' is currently not supported.</p>"
)
@PluginLicenseRestriction(moduleAffiliation = "OAuthServer")
public class DistributedClaimConfig {
   @StringListProperty(
      description = "<p>The claim name(s) to be obtained using the distributed claim.</p><p>These names will be used in the <tt>_claim_names</tt> object to reference this distributed claim.</p>",
      optional = false,
      minElements = 1
   )
   private List<String> claimNames;
   public static final String CLAIM_NAMES_PROPERTY = "claimNames";
   @StringProperty(
      description = "<p>The resource endpoint from which the associated Claim can be retrieved. The endpoint MUST return the Claim as a JWT.</p>",
      optional = false
   )
   private String endpointUrl;

   public String getEndpointUrl() {
      return this.endpointUrl;
   }

   public List<String> getClaimNames() {
      return this.claimNames;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public DistributedClaimConfig(List<String> claimNames, String endpointUrl) {
      this.claimNames = claimNames;
      this.endpointUrl = endpointUrl;
   }

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

   @SuppressFBWarnings(justification = "generated code")
   public static class DistributedClaimConfigBuilder {
      @SuppressFBWarnings(justification = "generated code")
      private List<String> claimNames;
      @SuppressFBWarnings(justification = "generated code")
      private String endpointUrl;

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

      @SuppressFBWarnings(justification = "generated code")
      public DistributedClaimConfig.DistributedClaimConfigBuilder claimNames(List<String> claimNames) {
         this.claimNames = claimNames;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public DistributedClaimConfig.DistributedClaimConfigBuilder endpointUrl(String endpointUrl) {
         this.endpointUrl = endpointUrl;
         return this;
      }

      @SuppressFBWarnings(justification = "generated code")
      public DistributedClaimConfig build() {
         return new DistributedClaimConfig(this.claimNames, this.endpointUrl);
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "DistributedClaimConfig.DistributedClaimConfigBuilder(claimNames=" + this.claimNames + ", endpointUrl=" + this.endpointUrl + ")";
      }
   }
}
