<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/firestore/v1beta1/write.proto

namespace Google\Cloud\Firestore\V1beta1\DocumentTransform;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A transformation of a field of the document.
 *
 * Generated from protobuf message <code>google.firestore.v1beta1.DocumentTransform.FieldTransform</code>
 */
class FieldTransform extends \Google\Protobuf\Internal\Message
{
    /**
     * The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax
     * reference.
     *
     * Generated from protobuf field <code>string field_path = 1;</code>
     */
    private $field_path = '';
    protected $transform_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $field_path
     *           The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax
     *           reference.
     *     @type int $set_to_server_value
     *           Sets the field to the given server value.
     *     @type \Google\Cloud\Firestore\V1beta1\ArrayValue $append_missing_elements
     *           Append the given elements in order if they are not already present in
     *           the current field value.
     *           If the field is not an array, or if the field does not yet exist, it is
     *           first set to the empty array.
     *           Equivalent numbers of different types (e.g. 3L and 3.0) are
     *           considered equal when checking if a value is missing.
     *           NaN is equal to NaN, and Null is equal to Null.
     *           If the input contains multiple equivalent values, only the first will
     *           be considered.
     *           The corresponding transform_result will be the null value.
     *     @type \Google\Cloud\Firestore\V1beta1\ArrayValue $remove_all_from_array
     *           Remove all of the given elements from the array in the field.
     *           If the field is not an array, or if the field does not yet exist, it is
     *           set to the empty array.
     *           Equivalent numbers of the different types (e.g. 3L and 3.0) are
     *           considered equal when deciding whether an element should be removed.
     *           NaN is equal to NaN, and Null is equal to Null.
     *           This will remove all equivalent values if there are duplicates.
     *           The corresponding transform_result will be the null value.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\V1Beta1\Write::initOnce();
        parent::__construct($data);
    }

    /**
     * The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax
     * reference.
     *
     * Generated from protobuf field <code>string field_path = 1;</code>
     * @return string
     */
    public function getFieldPath()
    {
        return $this->field_path;
    }

    /**
     * The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax
     * reference.
     *
     * Generated from protobuf field <code>string field_path = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setFieldPath($var)
    {
        GPBUtil::checkString($var, True);
        $this->field_path = $var;

        return $this;
    }

    /**
     * Sets the field to the given server value.
     *
     * Generated from protobuf field <code>.google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue set_to_server_value = 2;</code>
     * @return int
     */
    public function getSetToServerValue()
    {
        return $this->readOneof(2);
    }

    /**
     * Sets the field to the given server value.
     *
     * Generated from protobuf field <code>.google.firestore.v1beta1.DocumentTransform.FieldTransform.ServerValue set_to_server_value = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setSetToServerValue($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform_ServerValue::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Append the given elements in order if they are not already present in
     * the current field value.
     * If the field is not an array, or if the field does not yet exist, it is
     * first set to the empty array.
     * Equivalent numbers of different types (e.g. 3L and 3.0) are
     * considered equal when checking if a value is missing.
     * NaN is equal to NaN, and Null is equal to Null.
     * If the input contains multiple equivalent values, only the first will
     * be considered.
     * The corresponding transform_result will be the null value.
     *
     * Generated from protobuf field <code>.google.firestore.v1beta1.ArrayValue append_missing_elements = 6;</code>
     * @return \Google\Cloud\Firestore\V1beta1\ArrayValue
     */
    public function getAppendMissingElements()
    {
        return $this->readOneof(6);
    }

    /**
     * Append the given elements in order if they are not already present in
     * the current field value.
     * If the field is not an array, or if the field does not yet exist, it is
     * first set to the empty array.
     * Equivalent numbers of different types (e.g. 3L and 3.0) are
     * considered equal when checking if a value is missing.
     * NaN is equal to NaN, and Null is equal to Null.
     * If the input contains multiple equivalent values, only the first will
     * be considered.
     * The corresponding transform_result will be the null value.
     *
     * Generated from protobuf field <code>.google.firestore.v1beta1.ArrayValue append_missing_elements = 6;</code>
     * @param \Google\Cloud\Firestore\V1beta1\ArrayValue $var
     * @return $this
     */
    public function setAppendMissingElements($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\ArrayValue::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Remove all of the given elements from the array in the field.
     * If the field is not an array, or if the field does not yet exist, it is
     * set to the empty array.
     * Equivalent numbers of the different types (e.g. 3L and 3.0) are
     * considered equal when deciding whether an element should be removed.
     * NaN is equal to NaN, and Null is equal to Null.
     * This will remove all equivalent values if there are duplicates.
     * The corresponding transform_result will be the null value.
     *
     * Generated from protobuf field <code>.google.firestore.v1beta1.ArrayValue remove_all_from_array = 7;</code>
     * @return \Google\Cloud\Firestore\V1beta1\ArrayValue
     */
    public function getRemoveAllFromArray()
    {
        return $this->readOneof(7);
    }

    /**
     * Remove all of the given elements from the array in the field.
     * If the field is not an array, or if the field does not yet exist, it is
     * set to the empty array.
     * Equivalent numbers of the different types (e.g. 3L and 3.0) are
     * considered equal when deciding whether an element should be removed.
     * NaN is equal to NaN, and Null is equal to Null.
     * This will remove all equivalent values if there are duplicates.
     * The corresponding transform_result will be the null value.
     *
     * Generated from protobuf field <code>.google.firestore.v1beta1.ArrayValue remove_all_from_array = 7;</code>
     * @param \Google\Cloud\Firestore\V1beta1\ArrayValue $var
     * @return $this
     */
    public function setRemoveAllFromArray($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\V1beta1\ArrayValue::class);
        $this->writeOneof(7, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getTransformType()
    {
        return $this->whichOneof("transform_type");
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(FieldTransform::class, \Google\Cloud\Firestore\V1beta1\DocumentTransform_FieldTransform::class);

