<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/datastore/v1/query.proto

namespace Google\Cloud\Datastore\V1;

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

/**
 * A binding parameter for a GQL query.
 *
 * Generated from protobuf message <code>google.datastore.v1.GqlQueryParameter</code>
 */
class GqlQueryParameter extends \Google\Protobuf\Internal\Message
{
    protected $parameter_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Datastore\V1\Value $value
     *           A value parameter.
     *     @type string $cursor
     *           A query cursor. Query cursors are returned in query
     *           result batches.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Datastore\V1\Query::initOnce();
        parent::__construct($data);
    }

    /**
     * A value parameter.
     *
     * Generated from protobuf field <code>.google.datastore.v1.Value value = 2;</code>
     * @return \Google\Cloud\Datastore\V1\Value|null
     */
    public function getValue()
    {
        return $this->readOneof(2);
    }

    public function hasValue()
    {
        return $this->hasOneof(2);
    }

    /**
     * A value parameter.
     *
     * Generated from protobuf field <code>.google.datastore.v1.Value value = 2;</code>
     * @param \Google\Cloud\Datastore\V1\Value $var
     * @return $this
     */
    public function setValue($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Datastore\V1\Value::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * A query cursor. Query cursors are returned in query
     * result batches.
     *
     * Generated from protobuf field <code>bytes cursor = 3;</code>
     * @return string
     */
    public function getCursor()
    {
        return $this->readOneof(3);
    }

    public function hasCursor()
    {
        return $this->hasOneof(3);
    }

    /**
     * A query cursor. Query cursors are returned in query
     * result batches.
     *
     * Generated from protobuf field <code>bytes cursor = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setCursor($var)
    {
        GPBUtil::checkString($var, False);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

