<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: livekit_models.proto

namespace Livekit\DataStream;

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

/**
 * 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;
    /**
     * defaults to NONE
     *
     * Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7;</code>
     */
    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
     *           defaults to NONE
     *     @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;
    }

    /**
     * defaults to NONE
     *
     * Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7;</code>
     * @return int
     */
    public function getEncryptionType()
    {
        return $this->encryption_type;
    }

    /**
     * defaults to NONE
     *
     * Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7;</code>
     * @param int $var
     * @return $this
     */
    public function setEncryptionType($var)
    {
        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");
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Header::class, \Livekit\DataStream_Header::class);

