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

namespace Google\Cloud\PubSub\V1;

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

/**
 * Response for the `StreamingPull` method. This response is used to stream
 * messages from the server to the client.
 *
 * Generated from protobuf message <code>google.pubsub.v1.StreamingPullResponse</code>
 */
class StreamingPullResponse extends \Google\Protobuf\Internal\Message
{
    /**
     * Received Pub/Sub messages. This will not be empty.
     *
     * Generated from protobuf field <code>repeated .google.pubsub.v1.ReceivedMessage received_messages = 1;</code>
     */
    private $received_messages;
    /**
     * This field will only be set if `enable_exactly_once_delivery` is set to
     * `true`.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5;</code>
     */
    private $acknowledge_confirmation = null;
    /**
     * This field will only be set if `enable_exactly_once_delivery` is set to
     * `true`.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3;</code>
     */
    private $modify_ack_deadline_confirmation = null;
    /**
     * Properties associated with this subscription.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4;</code>
     */
    private $subscription_properties = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $received_messages
     *           Received Pub/Sub messages. This will not be empty.
     *     @type \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation $acknowledge_confirmation
     *           This field will only be set if `enable_exactly_once_delivery` is set to
     *           `true`.
     *     @type \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation $modify_ack_deadline_confirmation
     *           This field will only be set if `enable_exactly_once_delivery` is set to
     *           `true`.
     *     @type \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties $subscription_properties
     *           Properties associated with this subscription.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Pubsub\V1\Pubsub::initOnce();
        parent::__construct($data);
    }

    /**
     * Received Pub/Sub messages. This will not be empty.
     *
     * Generated from protobuf field <code>repeated .google.pubsub.v1.ReceivedMessage received_messages = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getReceivedMessages()
    {
        return $this->received_messages;
    }

    /**
     * Received Pub/Sub messages. This will not be empty.
     *
     * Generated from protobuf field <code>repeated .google.pubsub.v1.ReceivedMessage received_messages = 1;</code>
     * @param array<\Google\Cloud\PubSub\V1\ReceivedMessage>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setReceivedMessages($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\PubSub\V1\ReceivedMessage::class);
        $this->received_messages = $arr;

        return $this;
    }

    /**
     * This field will only be set if `enable_exactly_once_delivery` is set to
     * `true`.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5;</code>
     * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation|null
     */
    public function getAcknowledgeConfirmation()
    {
        return $this->acknowledge_confirmation;
    }

    public function hasAcknowledgeConfirmation()
    {
        return isset($this->acknowledge_confirmation);
    }

    public function clearAcknowledgeConfirmation()
    {
        unset($this->acknowledge_confirmation);
    }

    /**
     * This field will only be set if `enable_exactly_once_delivery` is set to
     * `true`.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.AcknowledgeConfirmation acknowledge_confirmation = 5;</code>
     * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation $var
     * @return $this
     */
    public function setAcknowledgeConfirmation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\AcknowledgeConfirmation::class);
        $this->acknowledge_confirmation = $var;

        return $this;
    }

    /**
     * This field will only be set if `enable_exactly_once_delivery` is set to
     * `true`.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3;</code>
     * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation|null
     */
    public function getModifyAckDeadlineConfirmation()
    {
        return $this->modify_ack_deadline_confirmation;
    }

    public function hasModifyAckDeadlineConfirmation()
    {
        return isset($this->modify_ack_deadline_confirmation);
    }

    public function clearModifyAckDeadlineConfirmation()
    {
        unset($this->modify_ack_deadline_confirmation);
    }

    /**
     * This field will only be set if `enable_exactly_once_delivery` is set to
     * `true`.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.ModifyAckDeadlineConfirmation modify_ack_deadline_confirmation = 3;</code>
     * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation $var
     * @return $this
     */
    public function setModifyAckDeadlineConfirmation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\ModifyAckDeadlineConfirmation::class);
        $this->modify_ack_deadline_confirmation = $var;

        return $this;
    }

    /**
     * Properties associated with this subscription.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4;</code>
     * @return \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties|null
     */
    public function getSubscriptionProperties()
    {
        return $this->subscription_properties;
    }

    public function hasSubscriptionProperties()
    {
        return isset($this->subscription_properties);
    }

    public function clearSubscriptionProperties()
    {
        unset($this->subscription_properties);
    }

    /**
     * Properties associated with this subscription.
     *
     * Generated from protobuf field <code>.google.pubsub.v1.StreamingPullResponse.SubscriptionProperties subscription_properties = 4;</code>
     * @param \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties $var
     * @return $this
     */
    public function setSubscriptionProperties($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\PubSub\V1\StreamingPullResponse\SubscriptionProperties::class);
        $this->subscription_properties = $var;

        return $this;
    }

}

