/*
 * 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.firestore.v1.model;

/**
 * A Firestore document.
 *
 * Must not exceed 1 MiB - 4 bytes.
 *
 * <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 Cloud Firestore 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 Document extends com.google.api.client.json.GenericJson {

  /**
   * Output only. The time at which the document was created.
   *
   * This value increases monotonically when a document is deleted then recreated. It can also be
   * compared to values from other documents and the `read_time` of a query.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String createTime;

  /**
   * The document's fields.
   *
   * The map keys represent field names.
   *
   * A simple field name contains only characters `a` to `z`, `A` to `Z`, `0` to `9`, or `_`, and
   * must not start with `0` to `9`. For example, `foo_bar_17`.
   *
   * Field names matching the regular expression `__.*__` are reserved. Reserved field names are
   * forbidden except in certain documented contexts. The map keys, represented as UTF-8, must not
   * exceed 1,500 bytes and cannot be empty.
   *
   * Field paths may be used in other contexts to refer to structured fields defined here. For
   * `map_value`, the field path is represented by the simple or quoted field names of the
   * containing fields, delimited by `.`. For example, the structured field `"foo" : { map_value: {
   * "x" : { string_value: "hello" }}}` would be represented by the field path `foo.x`.
   *
   * Within a field path, a quoted field name starts and ends with `` ` `` and may contain any
   * character. Some characters, including `` ` ``, must be escaped using a `\`. For example, `` `x`
   * `` represents `x` and `` `bak\`tik` `` represents `` bak`tik ``.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.Map<String, Value> fields;

  /**
   * The resource name of the document, for example
   * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String name;

  /**
   * Output only. The time at which the document was last changed.
   *
   * This value is initially set to the `create_time` then increases monotonically with each change
   * to the document. It can also be compared to values from other documents and the `read_time` of
   * a query.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String updateTime;

  /**
   * Output only. The time at which the document was created.
   *
   * This value increases monotonically when a document is deleted then recreated. It can also be
   * compared to values from other documents and the `read_time` of a query.
   * @return value or {@code null} for none
   */
  public String getCreateTime() {
    return createTime;
  }

  /**
   * Output only. The time at which the document was created.
   *
   * This value increases monotonically when a document is deleted then recreated. It can also be
   * compared to values from other documents and the `read_time` of a query.
   * @param createTime createTime or {@code null} for none
   */
  public Document setCreateTime(String createTime) {
    this.createTime = createTime;
    return this;
  }

  /**
   * The document's fields.
   *
   * The map keys represent field names.
   *
   * A simple field name contains only characters `a` to `z`, `A` to `Z`, `0` to `9`, or `_`, and
   * must not start with `0` to `9`. For example, `foo_bar_17`.
   *
   * Field names matching the regular expression `__.*__` are reserved. Reserved field names are
   * forbidden except in certain documented contexts. The map keys, represented as UTF-8, must not
   * exceed 1,500 bytes and cannot be empty.
   *
   * Field paths may be used in other contexts to refer to structured fields defined here. For
   * `map_value`, the field path is represented by the simple or quoted field names of the
   * containing fields, delimited by `.`. For example, the structured field `"foo" : { map_value: {
   * "x" : { string_value: "hello" }}}` would be represented by the field path `foo.x`.
   *
   * Within a field path, a quoted field name starts and ends with `` ` `` and may contain any
   * character. Some characters, including `` ` ``, must be escaped using a `\`. For example, `` `x`
   * `` represents `x` and `` `bak\`tik` `` represents `` bak`tik ``.
   * @return value or {@code null} for none
   */
  public java.util.Map<String, Value> getFields() {
    return fields;
  }

  /**
   * The document's fields.
   *
   * The map keys represent field names.
   *
   * A simple field name contains only characters `a` to `z`, `A` to `Z`, `0` to `9`, or `_`, and
   * must not start with `0` to `9`. For example, `foo_bar_17`.
   *
   * Field names matching the regular expression `__.*__` are reserved. Reserved field names are
   * forbidden except in certain documented contexts. The map keys, represented as UTF-8, must not
   * exceed 1,500 bytes and cannot be empty.
   *
   * Field paths may be used in other contexts to refer to structured fields defined here. For
   * `map_value`, the field path is represented by the simple or quoted field names of the
   * containing fields, delimited by `.`. For example, the structured field `"foo" : { map_value: {
   * "x" : { string_value: "hello" }}}` would be represented by the field path `foo.x`.
   *
   * Within a field path, a quoted field name starts and ends with `` ` `` and may contain any
   * character. Some characters, including `` ` ``, must be escaped using a `\`. For example, `` `x`
   * `` represents `x` and `` `bak\`tik` `` represents `` bak`tik ``.
   * @param fields fields or {@code null} for none
   */
  public Document setFields(java.util.Map<String, Value> fields) {
    this.fields = fields;
    return this;
  }

  /**
   * The resource name of the document, for example
   * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
   * @return value or {@code null} for none
   */
  public java.lang.String getName() {
    return name;
  }

  /**
   * The resource name of the document, for example
   * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
   * @param name name or {@code null} for none
   */
  public Document setName(java.lang.String name) {
    this.name = name;
    return this;
  }

  /**
   * Output only. The time at which the document was last changed.
   *
   * This value is initially set to the `create_time` then increases monotonically with each change
   * to the document. It can also be compared to values from other documents and the `read_time` of
   * a query.
   * @return value or {@code null} for none
   */
  public String getUpdateTime() {
    return updateTime;
  }

  /**
   * Output only. The time at which the document was last changed.
   *
   * This value is initially set to the `create_time` then increases monotonically with each change
   * to the document. It can also be compared to values from other documents and the `read_time` of
   * a query.
   * @param updateTime updateTime or {@code null} for none
   */
  public Document setUpdateTime(String updateTime) {
    this.updateTime = updateTime;
    return this;
  }

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

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

}
