content: /*
   * Iam
   * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
   *
   * The version of the OpenAPI document: 1.0.0
   * Contact: info@affinidi.com
   *
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  
  
  package com.affinidi.tdk.iam.client.models;
  
  import java.util.Objects;
  import java.util.Arrays;
  import com.fasterxml.jackson.annotation.JsonInclude;
  import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.annotation.JsonCreator;
  import com.fasterxml.jackson.annotation.JsonTypeName;
  import com.fasterxml.jackson.annotation.JsonValue;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.List;
  import com.fasterxml.jackson.annotation.JsonPropertyOrder;
  import com.fasterxml.jackson.annotation.JsonTypeName;
  import java.io.UnsupportedEncodingException;
  import java.net.URLEncoder;
  import java.util.StringJoiner;
  
  /**
   * PolicyStatementDto
   */
  @JsonPropertyOrder({
    PolicyStatementDto.JSON_PROPERTY_ACTION,
    PolicyStatementDto.JSON_PROPERTY_EFFECT,
    PolicyStatementDto.JSON_PROPERTY_PRINCIPAL,
    PolicyStatementDto.JSON_PROPERTY_RESOURCE
  })
  @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0")
  public class PolicyStatementDto {
    public static final String JSON_PROPERTY_ACTION = "action";
    @javax.annotation.Nonnull
    private List<String> action = new ArrayList<>();
  
    public static final String JSON_PROPERTY_EFFECT = "effect";
    @javax.annotation.Nonnull
    private String effect;
  
    public static final String JSON_PROPERTY_PRINCIPAL = "principal";
    @javax.annotation.Nonnull
    private List<String> principal = new ArrayList<>();
  
    public static final String JSON_PROPERTY_RESOURCE = "resource";
    @javax.annotation.Nonnull
    private List<String> resource = new ArrayList<>();
  
    public PolicyStatementDto() {
    }
  
    public PolicyStatementDto action(@javax.annotation.Nonnull List<String> action) {
      
      this.action = action;
      return this;
    }
  
    public PolicyStatementDto addActionItem(String actionItem) {
      if (this.action == null) {
        this.action = new ArrayList<>();
      }
      this.action.add(actionItem);
      return this;
    }
  
    /**
     * Get action
     * @return action
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_ACTION)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
  
    public List<String> getAction() {
      return action;
    }
  
  
    @JsonProperty(JSON_PROPERTY_ACTION)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setAction(@javax.annotation.Nonnull List<String> action) {
      this.action = action;
    }
  
    public PolicyStatementDto effect(@javax.annotation.Nonnull String effect) {
      
      this.effect = effect;
      return this;
    }
  
    /**
     * Get effect
     * @return effect
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_EFFECT)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
  
    public String getEffect() {
      return effect;
    }
  
  
    @JsonProperty(JSON_PROPERTY_EFFECT)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setEffect(@javax.annotation.Nonnull String effect) {
      this.effect = effect;
    }
  
    public PolicyStatementDto principal(@javax.annotation.Nonnull List<String> principal) {
      
      this.principal = principal;
      return this;
    }
  
    public PolicyStatementDto addPrincipalItem(String principalItem) {
      if (this.principal == null) {
        this.principal = new ArrayList<>();
      }
      this.principal.add(principalItem);
      return this;
    }
  
    /**
     * Get principal
     * @return principal
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_PRINCIPAL)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
  
    public List<String> getPrincipal() {
      return principal;
    }
  
  
    @JsonProperty(JSON_PROPERTY_PRINCIPAL)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setPrincipal(@javax.annotation.Nonnull List<String> principal) {
      this.principal = principal;
    }
  
    public PolicyStatementDto resource(@javax.annotation.Nonnull List<String> resource) {
      
      this.resource = resource;
      return this;
    }
  
    public PolicyStatementDto addResourceItem(String resourceItem) {
      if (this.resource == null) {
        this.resource = new ArrayList<>();
      }
      this.resource.add(resourceItem);
      return this;
    }
  
    /**
     * Get resource
     * @return resource
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_RESOURCE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
  
    public List<String> getResource() {
      return resource;
    }
  
  
    @JsonProperty(JSON_PROPERTY_RESOURCE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setResource(@javax.annotation.Nonnull List<String> resource) {
      this.resource = resource;
    }
  
    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      PolicyStatementDto policyStatementDto = (PolicyStatementDto) o;
      return Objects.equals(this.action, policyStatementDto.action) &&
          Objects.equals(this.effect, policyStatementDto.effect) &&
          Objects.equals(this.principal, policyStatementDto.principal) &&
          Objects.equals(this.resource, policyStatementDto.resource);
    }
  
    @Override
    public int hashCode() {
      return Objects.hash(action, effect, principal, resource);
    }
  
    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("class PolicyStatementDto {\n");
      sb.append("    action: ").append(toIndentedString(action)).append("\n");
      sb.append("    effect: ").append(toIndentedString(effect)).append("\n");
      sb.append("    principal: ").append(toIndentedString(principal)).append("\n");
      sb.append("    resource: ").append(toIndentedString(resource)).append("\n");
      sb.append("}");
      return sb.toString();
    }
  
    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(Object o) {
      if (o == null) {
        return "null";
      }
      return o.toString().replace("\n", "\n    ");
    }
  
    /**
     * Convert the instance into URL query string.
     *
     * @return URL query string
     */
    public String toUrlQueryString() {
      return toUrlQueryString(null);
    }
  
    /**
     * Convert the instance into URL query string.
     *
     * @param prefix prefix of the query string
     * @return URL query string
     */
    public String toUrlQueryString(String prefix) {
      String suffix = "";
      String containerSuffix = "";
      String containerPrefix = "";
      if (prefix == null) {
        // style=form, explode=true, e.g. /pet?name=cat&type=manx
        prefix = "";
      } else {
        // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
        prefix = prefix + "[";
        suffix = "]";
        containerSuffix = "]";
        containerPrefix = "[";
      }
  
      StringJoiner joiner = new StringJoiner("&");
  
      // add `action` to the URL query string
      if (getAction() != null) {
        for (int i = 0; i < getAction().size(); i++) {
          try {
            joiner.add(String.format("%saction%s%s=%s", prefix, suffix,
                "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
                URLEncoder.encode(String.valueOf(getAction().get(i)), "UTF-8").replaceAll("\\+", "%20")));
          } catch (UnsupportedEncodingException e) {
            // Should never happen, UTF-8 is always supported
            throw new RuntimeException(e);
          }
        }
      }
  
      // add `effect` to the URL query string
      if (getEffect() != null) {
        try {
          joiner.add(String.format("%seffect%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEffect()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      // add `principal` to the URL query string
      if (getPrincipal() != null) {
        for (int i = 0; i < getPrincipal().size(); i++) {
          try {
            joiner.add(String.format("%sprincipal%s%s=%s", prefix, suffix,
                "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
                URLEncoder.encode(String.valueOf(getPrincipal().get(i)), "UTF-8").replaceAll("\\+", "%20")));
          } catch (UnsupportedEncodingException e) {
            // Should never happen, UTF-8 is always supported
            throw new RuntimeException(e);
          }
        }
      }
  
      // add `resource` to the URL query string
      if (getResource() != null) {
        for (int i = 0; i < getResource().size(); i++) {
          try {
            joiner.add(String.format("%sresource%s%s=%s", prefix, suffix,
                "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
                URLEncoder.encode(String.valueOf(getResource().get(i)), "UTF-8").replaceAll("\\+", "%20")));
          } catch (UnsupportedEncodingException e) {
            // Should never happen, UTF-8 is always supported
            throw new RuntimeException(e);
          }
        }
      }
  
      return joiner.toString();
    }
  
  }
  
  