<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: livekit_models.proto

namespace Livekit\DataStream;

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

/**
 * main DataStream.Header that contains a oneof for specific headers
 *
 * Generated from protobuf message <code>livekit.DataStream.Header</code>
 */
class Header extends \Google\Protobuf\Internal\Message
{
    /**
     * unique identifier for this data stream
     *
     * Generated from protobuf field <code>string stream_id = 1;</code>
     */
    protected $stream_id = '';
    /**
     * using int64 for Unix timestamp
     *
     * Generated from protobuf field <code>int64 timestamp = 2;</code>
     */
    protected $timestamp = 0;
    /**
     * Generated from protobuf field <code>string topic = 3;</code>
     */
    protected $topic = '';
    /**
     * Generated from protobuf field <code>string mime_type = 4;</code>
     */
    protected $mime_type = '';
    /**
     * only populated for finite streams, if it's a stream of unknown size this stays empty
     *
     * Generated from protobuf field <code>optional uint64 total_length = 5;</code>
     */
    protected $total_length = null;
    /**
     *  this is set on the DataPacket
     *
     * Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7 [deprecated = true];</code>
     * @deprecated
     */
    protected $encryption_type = 0;
    /**
     * user defined attributes map that can carry additional info
     *
     * Generated from protobuf field <code>map<string, string> attributes = 8;</code>
     */
    private $attributes;
    protected $content_header;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $stream_id
     *           unique identifier for this data stream
     *     @type int|string $timestamp
     *           using int64 for Unix timestamp
     *     @type string $topic
     *     @type string $mime_type
     *     @type int|string $total_length
     *           only populated for finite streams, if it's a stream of unknown size this stays empty
     *     @type int $encryption_type
     *            this is set on the DataPacket
     *     @type array|\Google\Protobuf\Internal\MapField $attributes
     *           user defined attributes map that can carry additional info
     *     @type \Livekit\DataStream\TextHeader $text_header
     *     @type \Livekit\DataStream\ByteHeader $byte_header
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\LivekitModels::initOnce();
        parent::__construct($data);
    }

    /**
     * unique identifier for this data stream
     *
     * Generated from protobuf field <code>string stream_id = 1;</code>
     * @return string
     */
    public function getStreamId()
    {
        return $this->stream_id;
    }

    /**
     * unique identifier for this data stream
     *
     * Generated from protobuf field <code>string stream_id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setStreamId($var)
    {
        GPBUtil::checkString($var, True);
        $this->stream_id = $var;

        return $this;
    }

    /**
     * using int64 for Unix timestamp
     *
     * Generated from protobuf field <code>int64 timestamp = 2;</code>
     * @return int|string
     */
    public function getTimestamp()
    {
        return $this->timestamp;
    }

    /**
     * using int64 for Unix timestamp
     *
     * Generated from protobuf field <code>int64 timestamp = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setTimestamp($var)
    {
        GPBUtil::checkInt64($var);
        $this->timestamp = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>string topic = 3;</code>
     * @return string
     */
    public function getTopic()
    {
        return $this->topic;
    }

    /**
     * Generated from protobuf field <code>string topic = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setTopic($var)
    {
        GPBUtil::checkString($var, True);
        $this->topic = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>string mime_type = 4;</code>
     * @return string
     */
    public function getMimeType()
    {
        return $this->mime_type;
    }

    /**
     * Generated from protobuf field <code>string mime_type = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setMimeType($var)
    {
        GPBUtil::checkString($var, True);
        $this->mime_type = $var;

        return $this;
    }

    /**
     * only populated for finite streams, if it's a stream of unknown size this stays empty
     *
     * Generated from protobuf field <code>optional uint64 total_length = 5;</code>
     * @return int|string
     */
    public function getTotalLength()
    {
        return isset($this->total_length) ? $this->total_length : 0;
    }

    public function hasTotalLength()
    {
        return isset($this->total_length);
    }

    public function clearTotalLength()
    {
        unset($this->total_length);
    }

    /**
     * only populated for finite streams, if it's a stream of unknown size this stays empty
     *
     * Generated from protobuf field <code>optional uint64 total_length = 5;</code>
     * @param int|string $var
     * @return $this
     */
    public function setTotalLength($var)
    {
        GPBUtil::checkUint64($var);
        $this->total_length = $var;

        return $this;
    }

    /**
     *  this is set on the DataPacket
     *
     * Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7 [deprecated = true];</code>
     * @return int
     * @deprecated
     */
    public function getEncryptionType()
    {
        if ($this->encryption_type !== 0) {
            @trigger_error('encryption_type is deprecated.', E_USER_DEPRECATED);
        }
        return $this->encryption_type;
    }

    /**
     *  this is set on the DataPacket
     *
     * Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7 [deprecated = true];</code>
     * @param int $var
     * @return $this
     * @deprecated
     */
    public function setEncryptionType($var)
    {
        @trigger_error('encryption_type is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkEnum($var, \Livekit\Encryption\Type::class);
        $this->encryption_type = $var;

        return $this;
    }

    /**
     * user defined attributes map that can carry additional info
     *
     * Generated from protobuf field <code>map<string, string> attributes = 8;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getAttributes()
    {
        return $this->attributes;
    }

    /**
     * user defined attributes map that can carry additional info
     *
     * Generated from protobuf field <code>map<string, string> attributes = 8;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setAttributes($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->attributes = $arr;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.livekit.DataStream.TextHeader text_header = 9;</code>
     * @return \Livekit\DataStream\TextHeader|null
     */
    public function getTextHeader()
    {
        return $this->readOneof(9);
    }

    public function hasTextHeader()
    {
        return $this->hasOneof(9);
    }

    /**
     * Generated from protobuf field <code>.livekit.DataStream.TextHeader text_header = 9;</code>
     * @param \Livekit\DataStream\TextHeader $var
     * @return $this
     */
    public function setTextHeader($var)
    {
        GPBUtil::checkMessage($var, \Livekit\DataStream\TextHeader::class);
        $this->writeOneof(9, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.livekit.DataStream.ByteHeader byte_header = 10;</code>
     * @return \Livekit\DataStream\ByteHeader|null
     */
    public function getByteHeader()
    {
        return $this->readOneof(10);
    }

    public function hasByteHeader()
    {
        return $this->hasOneof(10);
    }

    /**
     * Generated from protobuf field <code>.livekit.DataStream.ByteHeader byte_header = 10;</code>
     * @param \Livekit\DataStream\ByteHeader $var
     * @return $this
     */
    public function setByteHeader($var)
    {
        GPBUtil::checkMessage($var, \Livekit\DataStream\ByteHeader::class);
        $this->writeOneof(10, $var);

        return $this;
    }

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

}

