/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.drive.model;

/**
 * A permission for a file. A permission grants a user, group, domain or the world access to a file
 * or a folder hierarchy.
 *
 * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Drive API. For a detailed explanation see:
 * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
 * </p>
 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Permission extends com.google.api.client.json.GenericJson {

  /**
   * Whether the permission allows the file to be discovered through search. This is only applicable
   * for permissions of type domain or anyone.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean allowFileDiscovery;

  /**
   * Whether the account associated with this permission has been deleted. This field only pertains
   * to user and group permissions.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.Boolean deleted;

  /**
   * The "pretty" name of the value of the permission. The following is a list of examples for each
   * type of permission: - user - User's full name, as defined for their Google account, such as
   * "Joe Smith."  - group - Name of the Google Group, such as "The Company Administrators."  -
   * domain - String domain name, such as "thecompany.com."  - anyone - No displayName is present.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String displayName;

  /**
   * The domain to which this permission refers.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String domain;

  /**
   * The email address of the user or group to which this permission refers.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String emailAddress;

  /**
   * The time at which this permission will expire (RFC 3339 date-time). Expiration times have the
   * following restrictions: - They can only be set on user and group permissions  - The time must
   * be in the future  - The time cannot be more than a year in the future
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private com.google.api.client.util.DateTime expirationTime;

  /**
   * The ID of this permission. This is a unique identifier for the grantee, and is published in
   * User resources as permissionId. IDs should be treated as opaque values.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String id;

  /**
   * Identifies what kind of resource this is. Value: the fixed string "drive#permission".
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String kind;

  /**
   * Details of whether the permissions on this shared drive item are inherited or directly on this
   * item. This is an output-only field which is present only for shared drive items.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<PermissionDetails> permissionDetails;

  static {
    // hack to force ProGuard to consider PermissionDetails used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(PermissionDetails.class);
  }

  /**
   * A link to the user's profile photo, if available.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String photoLink;

  /**
   * The role granted by this permission. While new values may be supported in the future, the
   * following are currently allowed: - owner  - organizer  - fileOrganizer  - writer  - commenter
   * - reader
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String role;

  /**
   * Deprecated - use permissionDetails instead.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<TeamDrivePermissionDetails> teamDrivePermissionDetails;

  static {
    // hack to force ProGuard to consider TeamDrivePermissionDetails used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(TeamDrivePermissionDetails.class);
  }

  /**
   * The type of the grantee. Valid values are: - user  - group  - domain  - anyone  When creating a
   * permission, if type is user or group, you must provide an emailAddress for the user or group.
   * When type is domain, you must provide a domain. There isn't extra information required for a
   * anyone type.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String type;

  /**
   * Indicates the view for this permission. Only populated for permissions that belong to a view.
   * published is the only supported value.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String view;

  /**
   * Whether the permission allows the file to be discovered through search. This is only applicable
   * for permissions of type domain or anyone.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getAllowFileDiscovery() {
    return allowFileDiscovery;
  }

  /**
   * Whether the permission allows the file to be discovered through search. This is only applicable
   * for permissions of type domain or anyone.
   * @param allowFileDiscovery allowFileDiscovery or {@code null} for none
   */
  public Permission setAllowFileDiscovery(java.lang.Boolean allowFileDiscovery) {
    this.allowFileDiscovery = allowFileDiscovery;
    return this;
  }

  /**
   * Whether the account associated with this permission has been deleted. This field only pertains
   * to user and group permissions.
   * @return value or {@code null} for none
   */
  public java.lang.Boolean getDeleted() {
    return deleted;
  }

  /**
   * Whether the account associated with this permission has been deleted. This field only pertains
   * to user and group permissions.
   * @param deleted deleted or {@code null} for none
   */
  public Permission setDeleted(java.lang.Boolean deleted) {
    this.deleted = deleted;
    return this;
  }

  /**
   * The "pretty" name of the value of the permission. The following is a list of examples for each
   * type of permission: - user - User's full name, as defined for their Google account, such as
   * "Joe Smith."  - group - Name of the Google Group, such as "The Company Administrators."  -
   * domain - String domain name, such as "thecompany.com."  - anyone - No displayName is present.
   * @return value or {@code null} for none
   */
  public java.lang.String getDisplayName() {
    return displayName;
  }

  /**
   * The "pretty" name of the value of the permission. The following is a list of examples for each
   * type of permission: - user - User's full name, as defined for their Google account, such as
   * "Joe Smith."  - group - Name of the Google Group, such as "The Company Administrators."  -
   * domain - String domain name, such as "thecompany.com."  - anyone - No displayName is present.
   * @param displayName displayName or {@code null} for none
   */
  public Permission setDisplayName(java.lang.String displayName) {
    this.displayName = displayName;
    return this;
  }

  /**
   * The domain to which this permission refers.
   * @return value or {@code null} for none
   */
  public java.lang.String getDomain() {
    return domain;
  }

  /**
   * The domain to which this permission refers.
   * @param domain domain or {@code null} for none
   */
  public Permission setDomain(java.lang.String domain) {
    this.domain = domain;
    return this;
  }

  /**
   * The email address of the user or group to which this permission refers.
   * @return value or {@code null} for none
   */
  public java.lang.String getEmailAddress() {
    return emailAddress;
  }

  /**
   * The email address of the user or group to which this permission refers.
   * @param emailAddress emailAddress or {@code null} for none
   */
  public Permission setEmailAddress(java.lang.String emailAddress) {
    this.emailAddress = emailAddress;
    return this;
  }

  /**
   * The time at which this permission will expire (RFC 3339 date-time). Expiration times have the
   * following restrictions: - They can only be set on user and group permissions  - The time must
   * be in the future  - The time cannot be more than a year in the future
   * @return value or {@code null} for none
   */
  public com.google.api.client.util.DateTime getExpirationTime() {
    return expirationTime;
  }

  /**
   * The time at which this permission will expire (RFC 3339 date-time). Expiration times have the
   * following restrictions: - They can only be set on user and group permissions  - The time must
   * be in the future  - The time cannot be more than a year in the future
   * @param expirationTime expirationTime or {@code null} for none
   */
  public Permission setExpirationTime(com.google.api.client.util.DateTime expirationTime) {
    this.expirationTime = expirationTime;
    return this;
  }

  /**
   * The ID of this permission. This is a unique identifier for the grantee, and is published in
   * User resources as permissionId. IDs should be treated as opaque values.
   * @return value or {@code null} for none
   */
  public java.lang.String getId() {
    return id;
  }

  /**
   * The ID of this permission. This is a unique identifier for the grantee, and is published in
   * User resources as permissionId. IDs should be treated as opaque values.
   * @param id id or {@code null} for none
   */
  public Permission setId(java.lang.String id) {
    this.id = id;
    return this;
  }

  /**
   * Identifies what kind of resource this is. Value: the fixed string "drive#permission".
   * @return value or {@code null} for none
   */
  public java.lang.String getKind() {
    return kind;
  }

  /**
   * Identifies what kind of resource this is. Value: the fixed string "drive#permission".
   * @param kind kind or {@code null} for none
   */
  public Permission setKind(java.lang.String kind) {
    this.kind = kind;
    return this;
  }

  /**
   * Details of whether the permissions on this shared drive item are inherited or directly on this
   * item. This is an output-only field which is present only for shared drive items.
   * @return value or {@code null} for none
   */
  public java.util.List<PermissionDetails> getPermissionDetails() {
    return permissionDetails;
  }

  /**
   * Details of whether the permissions on this shared drive item are inherited or directly on this
   * item. This is an output-only field which is present only for shared drive items.
   * @param permissionDetails permissionDetails or {@code null} for none
   */
  public Permission setPermissionDetails(java.util.List<PermissionDetails> permissionDetails) {
    this.permissionDetails = permissionDetails;
    return this;
  }

  /**
   * A link to the user's profile photo, if available.
   * @return value or {@code null} for none
   */
  public java.lang.String getPhotoLink() {
    return photoLink;
  }

  /**
   * A link to the user's profile photo, if available.
   * @param photoLink photoLink or {@code null} for none
   */
  public Permission setPhotoLink(java.lang.String photoLink) {
    this.photoLink = photoLink;
    return this;
  }

  /**
   * The role granted by this permission. While new values may be supported in the future, the
   * following are currently allowed: - owner  - organizer  - fileOrganizer  - writer  - commenter
   * - reader
   * @return value or {@code null} for none
   */
  public java.lang.String getRole() {
    return role;
  }

  /**
   * The role granted by this permission. While new values may be supported in the future, the
   * following are currently allowed: - owner  - organizer  - fileOrganizer  - writer  - commenter
   * - reader
   * @param role role or {@code null} for none
   */
  public Permission setRole(java.lang.String role) {
    this.role = role;
    return this;
  }

  /**
   * Deprecated - use permissionDetails instead.
   * @return value or {@code null} for none
   */
  public java.util.List<TeamDrivePermissionDetails> getTeamDrivePermissionDetails() {
    return teamDrivePermissionDetails;
  }

  /**
   * Deprecated - use permissionDetails instead.
   * @param teamDrivePermissionDetails teamDrivePermissionDetails or {@code null} for none
   */
  public Permission setTeamDrivePermissionDetails(java.util.List<TeamDrivePermissionDetails> teamDrivePermissionDetails) {
    this.teamDrivePermissionDetails = teamDrivePermissionDetails;
    return this;
  }

  /**
   * The type of the grantee. Valid values are: - user  - group  - domain  - anyone  When creating a
   * permission, if type is user or group, you must provide an emailAddress for the user or group.
   * When type is domain, you must provide a domain. There isn't extra information required for a
   * anyone type.
   * @return value or {@code null} for none
   */
  public java.lang.String getType() {
    return type;
  }

  /**
   * The type of the grantee. Valid values are: - user  - group  - domain  - anyone  When creating a
   * permission, if type is user or group, you must provide an emailAddress for the user or group.
   * When type is domain, you must provide a domain. There isn't extra information required for a
   * anyone type.
   * @param type type or {@code null} for none
   */
  public Permission setType(java.lang.String type) {
    this.type = type;
    return this;
  }

  /**
   * Indicates the view for this permission. Only populated for permissions that belong to a view.
   * published is the only supported value.
   * @return value or {@code null} for none
   */
  public java.lang.String getView() {
    return view;
  }

  /**
   * Indicates the view for this permission. Only populated for permissions that belong to a view.
   * published is the only supported value.
   * @param view view or {@code null} for none
   */
  public Permission setView(java.lang.String view) {
    this.view = view;
    return this;
  }

  @Override
  public Permission set(String fieldName, Object value) {
    return (Permission) super.set(fieldName, value);
  }

  @Override
  public Permission clone() {
    return (Permission) super.clone();
  }

  /**
   * Model definition for PermissionPermissionDetails.
   */
  public static final class PermissionDetails extends com.google.api.client.json.GenericJson {

    /**
     * Whether this permission is inherited. This field is always populated. This is an output-only
     * field.
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.Boolean inherited;

    /**
     * The ID of the item from which this permission is inherited. This is an output-only field.
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.String inheritedFrom;

    /**
     * The permission type for this user. While new values may be added in future, the following are
     * currently possible: - file  - member
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.String permissionType;

    /**
     * The primary role for this user. While new values may be added in the future, the following are
     * currently possible: - organizer  - fileOrganizer  - writer  - commenter  - reader
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.String role;

    /**
     * Whether this permission is inherited. This field is always populated. This is an output-only
     * field.
     * @return value or {@code null} for none
     */
    public java.lang.Boolean getInherited() {
      return inherited;
    }

    /**
     * Whether this permission is inherited. This field is always populated. This is an output-only
     * field.
     * @param inherited inherited or {@code null} for none
     */
    public PermissionDetails setInherited(java.lang.Boolean inherited) {
      this.inherited = inherited;
      return this;
    }

    /**
     * The ID of the item from which this permission is inherited. This is an output-only field.
     * @return value or {@code null} for none
     */
    public java.lang.String getInheritedFrom() {
      return inheritedFrom;
    }

    /**
     * The ID of the item from which this permission is inherited. This is an output-only field.
     * @param inheritedFrom inheritedFrom or {@code null} for none
     */
    public PermissionDetails setInheritedFrom(java.lang.String inheritedFrom) {
      this.inheritedFrom = inheritedFrom;
      return this;
    }

    /**
     * The permission type for this user. While new values may be added in future, the following are
     * currently possible: - file  - member
     * @return value or {@code null} for none
     */
    public java.lang.String getPermissionType() {
      return permissionType;
    }

    /**
     * The permission type for this user. While new values may be added in future, the following are
     * currently possible: - file  - member
     * @param permissionType permissionType or {@code null} for none
     */
    public PermissionDetails setPermissionType(java.lang.String permissionType) {
      this.permissionType = permissionType;
      return this;
    }

    /**
     * The primary role for this user. While new values may be added in the future, the following are
     * currently possible: - organizer  - fileOrganizer  - writer  - commenter  - reader
     * @return value or {@code null} for none
     */
    public java.lang.String getRole() {
      return role;
    }

    /**
     * The primary role for this user. While new values may be added in the future, the following are
     * currently possible: - organizer  - fileOrganizer  - writer  - commenter  - reader
     * @param role role or {@code null} for none
     */
    public PermissionDetails setRole(java.lang.String role) {
      this.role = role;
      return this;
    }

    @Override
    public PermissionDetails set(String fieldName, Object value) {
      return (PermissionDetails) super.set(fieldName, value);
    }

    @Override
    public PermissionDetails clone() {
      return (PermissionDetails) super.clone();
    }

  }

  /**
   * Model definition for PermissionTeamDrivePermissionDetails.
   */
  public static final class TeamDrivePermissionDetails extends com.google.api.client.json.GenericJson {

    /**
     * Deprecated - use permissionDetails/inherited instead.
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.Boolean inherited;

    /**
     * Deprecated - use permissionDetails/inheritedFrom instead.
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.String inheritedFrom;

    /**
     * Deprecated - use permissionDetails/role instead.
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.String role;

    /**
     * Deprecated - use permissionDetails/permissionType instead.
     * The value may be {@code null}.
     */
    @com.google.api.client.util.Key
    private java.lang.String teamDrivePermissionType;

    /**
     * Deprecated - use permissionDetails/inherited instead.
     * @return value or {@code null} for none
     */
    public java.lang.Boolean getInherited() {
      return inherited;
    }

    /**
     * Deprecated - use permissionDetails/inherited instead.
     * @param inherited inherited or {@code null} for none
     */
    public TeamDrivePermissionDetails setInherited(java.lang.Boolean inherited) {
      this.inherited = inherited;
      return this;
    }

    /**
     * Deprecated - use permissionDetails/inheritedFrom instead.
     * @return value or {@code null} for none
     */
    public java.lang.String getInheritedFrom() {
      return inheritedFrom;
    }

    /**
     * Deprecated - use permissionDetails/inheritedFrom instead.
     * @param inheritedFrom inheritedFrom or {@code null} for none
     */
    public TeamDrivePermissionDetails setInheritedFrom(java.lang.String inheritedFrom) {
      this.inheritedFrom = inheritedFrom;
      return this;
    }

    /**
     * Deprecated - use permissionDetails/role instead.
     * @return value or {@code null} for none
     */
    public java.lang.String getRole() {
      return role;
    }

    /**
     * Deprecated - use permissionDetails/role instead.
     * @param role role or {@code null} for none
     */
    public TeamDrivePermissionDetails setRole(java.lang.String role) {
      this.role = role;
      return this;
    }

    /**
     * Deprecated - use permissionDetails/permissionType instead.
     * @return value or {@code null} for none
     */
    public java.lang.String getTeamDrivePermissionType() {
      return teamDrivePermissionType;
    }

    /**
     * Deprecated - use permissionDetails/permissionType instead.
     * @param teamDrivePermissionType teamDrivePermissionType or {@code null} for none
     */
    public TeamDrivePermissionDetails setTeamDrivePermissionType(java.lang.String teamDrivePermissionType) {
      this.teamDrivePermissionType = teamDrivePermissionType;
      return this;
    }

    @Override
    public TeamDrivePermissionDetails set(String fieldName, Object value) {
      return (TeamDrivePermissionDetails) super.set(fieldName, value);
    }

    @Override
    public TeamDrivePermissionDetails clone() {
      return (TeamDrivePermissionDetails) super.clone();
    }

  }

}
