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

namespace Google\Apps\Chat\V1;

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

/**
 * A user's read state within a thread, used to identify read and unread
 * messages.
 *
 * Generated from protobuf message <code>google.chat.v1.ThreadReadState</code>
 */
class ThreadReadState extends \Google\Protobuf\Internal\Message
{
    /**
     * Resource name of the thread read state.
     * Format: `users/{user}/spaces/{space}/threads/{thread}/threadReadState`
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    protected $name = '';
    /**
     * The time when the user's thread read state was updated. Usually this
     * corresponds with the timestamp of the last read message in a thread.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_read_time = 2;</code>
     */
    protected $last_read_time = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Resource name of the thread read state.
     *           Format: `users/{user}/spaces/{space}/threads/{thread}/threadReadState`
     *     @type \Google\Protobuf\Timestamp $last_read_time
     *           The time when the user's thread read state was updated. Usually this
     *           corresponds with the timestamp of the last read message in a thread.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Chat\V1\ThreadReadState::initOnce();
        parent::__construct($data);
    }

    /**
     * Resource name of the thread read state.
     * Format: `users/{user}/spaces/{space}/threads/{thread}/threadReadState`
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Resource name of the thread read state.
     * Format: `users/{user}/spaces/{space}/threads/{thread}/threadReadState`
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The time when the user's thread read state was updated. Usually this
     * corresponds with the timestamp of the last read message in a thread.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_read_time = 2;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getLastReadTime()
    {
        return $this->last_read_time;
    }

    public function hasLastReadTime()
    {
        return isset($this->last_read_time);
    }

    public function clearLastReadTime()
    {
        unset($this->last_read_time);
    }

    /**
     * The time when the user's thread read state was updated. Usually this
     * corresponds with the timestamp of the last read message in a thread.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_read_time = 2;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setLastReadTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->last_read_time = $var;

        return $this;
    }

}

