001package com.box.sdkgen.managers.metadatacascadepolicies;
002
003import com.box.sdkgen.internal.SerializableObject;
004import com.box.sdkgen.serialization.json.EnumWrapper;
005import com.fasterxml.jackson.annotation.JsonFilter;
006import com.fasterxml.jackson.annotation.JsonProperty;
007import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
008import com.fasterxml.jackson.databind.annotation.JsonSerialize;
009import java.util.Objects;
010
011@JsonFilter("nullablePropertyFilter")
012public class CreateMetadataCascadePolicyRequestBody extends SerializableObject {
013
014  /**
015   * The ID of the folder to apply the policy to. This folder will need to already have an instance
016   * of the targeted metadata template applied to it.
017   */
018  @JsonProperty("folder_id")
019  protected final String folderId;
020
021  /**
022   * The scope of the targeted metadata template. This template will need to already have an
023   * instance applied to the targeted folder.
024   */
025  @JsonDeserialize(
026      using =
027          CreateMetadataCascadePolicyRequestBodyScopeField
028              .CreateMetadataCascadePolicyRequestBodyScopeFieldDeserializer.class)
029  @JsonSerialize(
030      using =
031          CreateMetadataCascadePolicyRequestBodyScopeField
032              .CreateMetadataCascadePolicyRequestBodyScopeFieldSerializer.class)
033  protected final EnumWrapper<CreateMetadataCascadePolicyRequestBodyScopeField> scope;
034
035  /**
036   * The key of the targeted metadata template. This template will need to already have an instance
037   * applied to the targeted folder.
038   *
039   * <p>In many cases the template key is automatically derived of its display name, for example
040   * `Contract Template` would become `contractTemplate`. In some cases the creator of the template
041   * will have provided its own template key.
042   *
043   * <p>Please [list the templates for an enterprise][list], or get all instances on a [file][file]
044   * or [folder][folder] to inspect a template's key.
045   *
046   * <p>[list]: https://developer.box.com/reference/get-metadata-templates-enterprise [file]:
047   * https://developer.box.com/reference/get-files-id-metadata [folder]:
048   * https://developer.box.com/reference/get-folders-id-metadata
049   */
050  protected final String templateKey;
051
052  public CreateMetadataCascadePolicyRequestBody(
053      String folderId, CreateMetadataCascadePolicyRequestBodyScopeField scope, String templateKey) {
054    super();
055    this.folderId = folderId;
056    this.scope = new EnumWrapper<CreateMetadataCascadePolicyRequestBodyScopeField>(scope);
057    this.templateKey = templateKey;
058  }
059
060  public CreateMetadataCascadePolicyRequestBody(
061      @JsonProperty("folder_id") String folderId,
062      @JsonProperty("scope") EnumWrapper<CreateMetadataCascadePolicyRequestBodyScopeField> scope,
063      @JsonProperty("templateKey") String templateKey) {
064    super();
065    this.folderId = folderId;
066    this.scope = scope;
067    this.templateKey = templateKey;
068  }
069
070  public String getFolderId() {
071    return folderId;
072  }
073
074  public EnumWrapper<CreateMetadataCascadePolicyRequestBodyScopeField> getScope() {
075    return scope;
076  }
077
078  public String getTemplateKey() {
079    return templateKey;
080  }
081
082  @Override
083  public boolean equals(Object o) {
084    if (this == o) {
085      return true;
086    }
087    if (o == null || getClass() != o.getClass()) {
088      return false;
089    }
090    CreateMetadataCascadePolicyRequestBody casted = (CreateMetadataCascadePolicyRequestBody) o;
091    return Objects.equals(folderId, casted.folderId)
092        && Objects.equals(scope, casted.scope)
093        && Objects.equals(templateKey, casted.templateKey);
094  }
095
096  @Override
097  public int hashCode() {
098    return Objects.hash(folderId, scope, templateKey);
099  }
100
101  @Override
102  public String toString() {
103    return "CreateMetadataCascadePolicyRequestBody{"
104        + "folderId='"
105        + folderId
106        + '\''
107        + ", "
108        + "scope='"
109        + scope
110        + '\''
111        + ", "
112        + "templateKey='"
113        + templateKey
114        + '\''
115        + "}";
116  }
117}