001package com.box.sdkgen.schemas.file;
002
003import com.box.sdkgen.internal.SerializableObject;
004import com.fasterxml.jackson.annotation.JsonFilter;
005import com.fasterxml.jackson.annotation.JsonProperty;
006import java.util.Objects;
007
008@JsonFilter("nullablePropertyFilter")
009public class FileSharedLinkPermissionsField extends SerializableObject {
010
011  /**
012   * Defines if the shared link allows for the item to be downloaded. For shared links on folders,
013   * this also applies to any items in the folder.
014   *
015   * <p>This value can be set to `true` when the effective access level is set to `open` or
016   * `company`, not `collaborators`.
017   */
018  @JsonProperty("can_download")
019  protected final boolean canDownload;
020
021  /**
022   * Defines if the shared link allows for the item to be previewed.
023   *
024   * <p>This value is always `true`. For shared links on folders this also applies to any items in
025   * the folder.
026   */
027  @JsonProperty("can_preview")
028  protected final boolean canPreview;
029
030  /**
031   * Defines if the shared link allows for the item to be edited.
032   *
033   * <p>This value can only be `true` if `can_download` is also `true` and if the item has a type of
034   * `file`.
035   */
036  @JsonProperty("can_edit")
037  protected final boolean canEdit;
038
039  public FileSharedLinkPermissionsField(
040      @JsonProperty("can_download") boolean canDownload,
041      @JsonProperty("can_preview") boolean canPreview,
042      @JsonProperty("can_edit") boolean canEdit) {
043    super();
044    this.canDownload = canDownload;
045    this.canPreview = canPreview;
046    this.canEdit = canEdit;
047  }
048
049  public boolean getCanDownload() {
050    return canDownload;
051  }
052
053  public boolean getCanPreview() {
054    return canPreview;
055  }
056
057  public boolean getCanEdit() {
058    return canEdit;
059  }
060
061  @Override
062  public boolean equals(Object o) {
063    if (this == o) {
064      return true;
065    }
066    if (o == null || getClass() != o.getClass()) {
067      return false;
068    }
069    FileSharedLinkPermissionsField casted = (FileSharedLinkPermissionsField) o;
070    return Objects.equals(canDownload, casted.canDownload)
071        && Objects.equals(canPreview, casted.canPreview)
072        && Objects.equals(canEdit, casted.canEdit);
073  }
074
075  @Override
076  public int hashCode() {
077    return Objects.hash(canDownload, canPreview, canEdit);
078  }
079
080  @Override
081  public String toString() {
082    return "FileSharedLinkPermissionsField{"
083        + "canDownload='"
084        + canDownload
085        + '\''
086        + ", "
087        + "canPreview='"
088        + canPreview
089        + '\''
090        + ", "
091        + "canEdit='"
092        + canEdit
093        + '\''
094        + "}";
095  }
096}