All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adyen.model.sessionauthentication.Policy Maven / Gradle / Ivy

There is a newer version: 38.1.0
Show newest version
/*
 * Session authentication API
 *
 * The version of the OpenAPI document: 1
 * 
 *
 * 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.adyen.model.sessionauthentication;

import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.adyen.model.sessionauthentication.Resource;
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 com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.JsonProcessingException;


/**
 * Policy
 */
@JsonPropertyOrder({
  Policy.JSON_PROPERTY_RESOURCES,
  Policy.JSON_PROPERTY_ROLES
})

public class Policy {
  public static final String JSON_PROPERTY_RESOURCES = "resources";
  private Set resources;

  public static final String JSON_PROPERTY_ROLES = "roles";
  private Set roles;

  public Policy() { 
  }

  /**
   * An object containing the type and the unique identifier of the user of the component.  For [Onboarding components](https://docs.adyen.com/platforms/onboard-users/components), this is the ID of the legal entity that has a contractual relationship with your platform. For sole proprietorships, use the ID of the legal entity of the individual owner.  For [Platform Experience components](https://docs.adyen.com/platforms/build-user-dashboards), this is the ID of the account holder that is associated with the balance account shown in the component.
   *
   * @param resources An object containing the type and the unique identifier of the user of the component.  For [Onboarding components](https://docs.adyen.com/platforms/onboard-users/components), this is the ID of the legal entity that has a contractual relationship with your platform. For sole proprietorships, use the ID of the legal entity of the individual owner.  For [Platform Experience components](https://docs.adyen.com/platforms/build-user-dashboards), this is the ID of the account holder that is associated with the balance account shown in the component.
   * @return the current {@code Policy} instance, allowing for method chaining
   */
  public Policy resources(Set resources) {
    this.resources = resources;
    return this;
  }

  public Policy addResourcesItem(Resource resourcesItem) {
    if (this.resources == null) {
      this.resources = new LinkedHashSet<>();
    }
    this.resources.add(resourcesItem);
    return this;
  }

  /**
   * An object containing the type and the unique identifier of the user of the component.  For [Onboarding components](https://docs.adyen.com/platforms/onboard-users/components), this is the ID of the legal entity that has a contractual relationship with your platform. For sole proprietorships, use the ID of the legal entity of the individual owner.  For [Platform Experience components](https://docs.adyen.com/platforms/build-user-dashboards), this is the ID of the account holder that is associated with the balance account shown in the component.
   * @return resources An object containing the type and the unique identifier of the user of the component.  For [Onboarding components](https://docs.adyen.com/platforms/onboard-users/components), this is the ID of the legal entity that has a contractual relationship with your platform. For sole proprietorships, use the ID of the legal entity of the individual owner.  For [Platform Experience components](https://docs.adyen.com/platforms/build-user-dashboards), this is the ID of the account holder that is associated with the balance account shown in the component.
   */
  @JsonProperty(JSON_PROPERTY_RESOURCES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public Set getResources() {
    return resources;
  }

  /**
   * An object containing the type and the unique identifier of the user of the component.  For [Onboarding components](https://docs.adyen.com/platforms/onboard-users/components), this is the ID of the legal entity that has a contractual relationship with your platform. For sole proprietorships, use the ID of the legal entity of the individual owner.  For [Platform Experience components](https://docs.adyen.com/platforms/build-user-dashboards), this is the ID of the account holder that is associated with the balance account shown in the component.
   *
   * @param resources An object containing the type and the unique identifier of the user of the component.  For [Onboarding components](https://docs.adyen.com/platforms/onboard-users/components), this is the ID of the legal entity that has a contractual relationship with your platform. For sole proprietorships, use the ID of the legal entity of the individual owner.  For [Platform Experience components](https://docs.adyen.com/platforms/build-user-dashboards), this is the ID of the account holder that is associated with the balance account shown in the component.
   */
  @JsonDeserialize(as = LinkedHashSet.class)
  @JsonProperty(JSON_PROPERTY_RESOURCES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setResources(Set resources) {
    this.resources = resources;
  }

  /**
   * The name of the role required to use the component.
   *
   * @param roles The name of the role required to use the component.
   * @return the current {@code Policy} instance, allowing for method chaining
   */
  public Policy roles(Set roles) {
    this.roles = roles;
    return this;
  }

  public Policy addRolesItem(String rolesItem) {
    if (this.roles == null) {
      this.roles = new LinkedHashSet<>();
    }
    this.roles.add(rolesItem);
    return this;
  }

  /**
   * The name of the role required to use the component.
   * @return roles The name of the role required to use the component.
   */
  @JsonProperty(JSON_PROPERTY_ROLES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public Set getRoles() {
    return roles;
  }

  /**
   * The name of the role required to use the component.
   *
   * @param roles The name of the role required to use the component.
   */
  @JsonDeserialize(as = LinkedHashSet.class)
  @JsonProperty(JSON_PROPERTY_ROLES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setRoles(Set roles) {
    this.roles = roles;
  }

  /**
   * Return true if this Policy object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Policy policy = (Policy) o;
    return Objects.equals(this.resources, policy.resources) &&
        Objects.equals(this.roles, policy.roles);
  }

  @Override
  public int hashCode() {
    return Objects.hash(resources, roles);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Policy {\n");
    sb.append("    resources: ").append(toIndentedString(resources)).append("\n");
    sb.append("    roles: ").append(toIndentedString(roles)).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    ");
  }

/**
   * Create an instance of Policy given an JSON string
   *
   * @param jsonString JSON string
   * @return An instance of Policy
   * @throws JsonProcessingException if the JSON string is invalid with respect to Policy
   */
  public static Policy fromJson(String jsonString) throws JsonProcessingException {
    return JSON.getMapper().readValue(jsonString, Policy.class);
  }
/**
  * Convert an instance of Policy to an JSON string
  *
  * @return JSON string
  */
  public String toJson() throws JsonProcessingException {
    return JSON.getMapper().writeValueAsString(this);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy