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

namespace Google\Cloud\Iot\V1;

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

/**
 * Request for `ModifyCloudToDeviceConfig`.
 *
 * Generated from protobuf message <code>google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest</code>
 */
class ModifyCloudToDeviceConfigRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The name of the device. For example,
     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    private $name = '';
    /**
     * The version number to update. If this value is zero, it will not check the
     * version number of the server and will always update the current version;
     * otherwise, this update will fail if the version number found on the server
     * does not match this version number. This is used to support multiple
     * simultaneous updates without losing data.
     *
     * Generated from protobuf field <code>int64 version_to_update = 2;</code>
     */
    private $version_to_update = 0;
    /**
     * Required. The configuration data for the device.
     *
     * Generated from protobuf field <code>bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $binary_data = '';

    /**
     * @param string $name       Required. The name of the device. For example,
     *                           `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
     *                           `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. Please see
     *                           {@see DeviceManagerClient::deviceName()} for help formatting this field.
     * @param string $binaryData Required. The configuration data for the device.
     *
     * @return \Google\Cloud\Iot\V1\ModifyCloudToDeviceConfigRequest
     *
     * @experimental
     */
    public static function build(string $name, string $binaryData): self
    {
        return (new self())
            ->setName($name)
            ->setBinaryData($binaryData);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. The name of the device. For example,
     *           `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
     *           `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
     *     @type int|string $version_to_update
     *           The version number to update. If this value is zero, it will not check the
     *           version number of the server and will always update the current version;
     *           otherwise, this update will fail if the version number found on the server
     *           does not match this version number. This is used to support multiple
     *           simultaneous updates without losing data.
     *     @type string $binary_data
     *           Required. The configuration data for the device.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Iot\V1\DeviceManager::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The name of the device. For example,
     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. The name of the device. For example,
     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The version number to update. If this value is zero, it will not check the
     * version number of the server and will always update the current version;
     * otherwise, this update will fail if the version number found on the server
     * does not match this version number. This is used to support multiple
     * simultaneous updates without losing data.
     *
     * Generated from protobuf field <code>int64 version_to_update = 2;</code>
     * @return int|string
     */
    public function getVersionToUpdate()
    {
        return $this->version_to_update;
    }

    /**
     * The version number to update. If this value is zero, it will not check the
     * version number of the server and will always update the current version;
     * otherwise, this update will fail if the version number found on the server
     * does not match this version number. This is used to support multiple
     * simultaneous updates without losing data.
     *
     * Generated from protobuf field <code>int64 version_to_update = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setVersionToUpdate($var)
    {
        GPBUtil::checkInt64($var);
        $this->version_to_update = $var;

        return $this;
    }

    /**
     * Required. The configuration data for the device.
     *
     * Generated from protobuf field <code>bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getBinaryData()
    {
        return $this->binary_data;
    }

    /**
     * Required. The configuration data for the device.
     *
     * Generated from protobuf field <code>bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setBinaryData($var)
    {
        GPBUtil::checkString($var, False);
        $this->binary_data = $var;

        return $this;
    }

}

