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

namespace Keyapis\Device\V1;

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

/**
 * Ответ на запрос на создание/изменение устройства
 *
 * Generated from protobuf message <code>keyapis.device.v1.PostDeviceResponse</code>
 */
class PostDeviceResponse extends \Google\Protobuf\Internal\Message
{
    protected $type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Keyapis\Device\V1\Device $data
     *           Устройство
     *     @type \Keyapis\Device\V1\PostDeviceResponse\Error $error
     *           Ошибка
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\Device\V1\KeyapisDeviceDeviceV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Устройство
     *
     * Generated from protobuf field <code>.keyapis.device.v1.Device data = 1;</code>
     * @return \Keyapis\Device\V1\Device|null
     */
    public function getData()
    {
        return $this->readOneof(1);
    }

    public function hasData()
    {
        return $this->hasOneof(1);
    }

    /**
     * Устройство
     *
     * Generated from protobuf field <code>.keyapis.device.v1.Device data = 1;</code>
     * @param \Keyapis\Device\V1\Device $var
     * @return $this
     */
    public function setData($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Device\V1\Device::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Ошибка
     *
     * Generated from protobuf field <code>.keyapis.device.v1.PostDeviceResponse.Error error = 2;</code>
     * @return \Keyapis\Device\V1\PostDeviceResponse\Error|null
     */
    public function getError()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Ошибка
     *
     * Generated from protobuf field <code>.keyapis.device.v1.PostDeviceResponse.Error error = 2;</code>
     * @param \Keyapis\Device\V1\PostDeviceResponse\Error $var
     * @return $this
     */
    public function setError($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Device\V1\PostDeviceResponse\Error::class);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

