<?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.SyncStatus</code>
 */
class SyncStatus extends \Google\Protobuf\Internal\Message
{
    /**
     * Статус синхронизации
     *
     * Generated from protobuf field <code>.keyapis.device.v1.SyncStatus.StatusType status_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $status_type = 0;
    /**
     * Сообщение об ошибке
     *
     * Generated from protobuf field <code>string error_message = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $error_message = '';
    /**
     * Количество попыток
     *
     * Generated from protobuf field <code>int32 retry_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $retry_count = 0;
    /**
     * Дата последней успешной синхронизации.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp successful_at = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $successful_at = null;
    /**
     * Дата последней синхронизации.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp sync_at = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $sync_at = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $status_type
     *           Статус синхронизации
     *     @type string $error_message
     *           Сообщение об ошибке
     *     @type int $retry_count
     *           Количество попыток
     *     @type \Google\Protobuf\Timestamp $successful_at
     *           Дата последней успешной синхронизации.
     *           # Тип: DateTime
     *     @type \Google\Protobuf\Timestamp $sync_at
     *           Дата последней синхронизации.
     *           # Тип: DateTime
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\Device\V1\KeyapisDeviceDeviceV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Статус синхронизации
     *
     * Generated from protobuf field <code>.keyapis.device.v1.SyncStatus.StatusType status_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getStatusType()
    {
        return $this->status_type;
    }

    /**
     * Статус синхронизации
     *
     * Generated from protobuf field <code>.keyapis.device.v1.SyncStatus.StatusType status_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setStatusType($var)
    {
        GPBUtil::checkEnum($var, \Keyapis\Device\V1\SyncStatus\StatusType::class);
        $this->status_type = $var;

        return $this;
    }

    /**
     * Сообщение об ошибке
     *
     * Generated from protobuf field <code>string error_message = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getErrorMessage()
    {
        return $this->error_message;
    }

    /**
     * Сообщение об ошибке
     *
     * Generated from protobuf field <code>string error_message = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setErrorMessage($var)
    {
        GPBUtil::checkString($var, True);
        $this->error_message = $var;

        return $this;
    }

    /**
     * Количество попыток
     *
     * Generated from protobuf field <code>int32 retry_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getRetryCount()
    {
        return $this->retry_count;
    }

    /**
     * Количество попыток
     *
     * Generated from protobuf field <code>int32 retry_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setRetryCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->retry_count = $var;

        return $this;
    }

    /**
     * Дата последней успешной синхронизации.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp successful_at = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getSuccessfulAt()
    {
        return $this->successful_at;
    }

    public function hasSuccessfulAt()
    {
        return isset($this->successful_at);
    }

    public function clearSuccessfulAt()
    {
        unset($this->successful_at);
    }

    /**
     * Дата последней успешной синхронизации.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp successful_at = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setSuccessfulAt($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->successful_at = $var;

        return $this;
    }

    /**
     * Дата последней синхронизации.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp sync_at = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getSyncAt()
    {
        return $this->sync_at;
    }

    public function hasSyncAt()
    {
        return isset($this->sync_at);
    }

    public function clearSyncAt()
    {
        unset($this->sync_at);
    }

    /**
     * Дата последней синхронизации.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp sync_at = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setSyncAt($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->sync_at = $var;

        return $this;
    }

}

