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

namespace Livekit;

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

/**
 * new DataPacket API
 *
 * Generated from protobuf message <code>livekit.DataPacket</code>
 */
class DataPacket extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>.livekit.DataPacket.Kind kind = 1 [deprecated = true];</code>
     * @deprecated
     */
    protected $kind = 0;
    /**
     * participant identity of user that sent the message
     *
     * Generated from protobuf field <code>string participant_identity = 4;</code>
     */
    protected $participant_identity = '';
    /**
     * identities of participants who will receive the message (sent to all by default)
     *
     * Generated from protobuf field <code>repeated string destination_identities = 5;</code>
     */
    private $destination_identities;
    protected $value;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $kind
     *     @type string $participant_identity
     *           participant identity of user that sent the message
     *     @type string[]|\Google\Protobuf\Internal\RepeatedField $destination_identities
     *           identities of participants who will receive the message (sent to all by default)
     *     @type \Livekit\UserPacket $user
     *     @type \Livekit\ActiveSpeakerUpdate $speaker
     *     @type \Livekit\SipDTMF $sip_dtmf
     *     @type \Livekit\Transcription $transcription
     *     @type \Livekit\MetricsBatch $metrics
     *     @type \Livekit\ChatMessage $chat_message
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\LivekitModels::initOnce();
        parent::__construct($data);
    }

    /**
     * Generated from protobuf field <code>.livekit.DataPacket.Kind kind = 1 [deprecated = true];</code>
     * @return int
     * @deprecated
     */
    public function getKind()
    {
        @trigger_error('kind is deprecated.', E_USER_DEPRECATED);
        return $this->kind;
    }

    /**
     * Generated from protobuf field <code>.livekit.DataPacket.Kind kind = 1 [deprecated = true];</code>
     * @param int $var
     * @return $this
     * @deprecated
     */
    public function setKind($var)
    {
        @trigger_error('kind is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkEnum($var, \Livekit\DataPacket\Kind::class);
        $this->kind = $var;

        return $this;
    }

    /**
     * participant identity of user that sent the message
     *
     * Generated from protobuf field <code>string participant_identity = 4;</code>
     * @return string
     */
    public function getParticipantIdentity()
    {
        return $this->participant_identity;
    }

    /**
     * participant identity of user that sent the message
     *
     * Generated from protobuf field <code>string participant_identity = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setParticipantIdentity($var)
    {
        GPBUtil::checkString($var, True);
        $this->participant_identity = $var;

        return $this;
    }

    /**
     * identities of participants who will receive the message (sent to all by default)
     *
     * Generated from protobuf field <code>repeated string destination_identities = 5;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getDestinationIdentities()
    {
        return $this->destination_identities;
    }

    /**
     * identities of participants who will receive the message (sent to all by default)
     *
     * Generated from protobuf field <code>repeated string destination_identities = 5;</code>
     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setDestinationIdentities($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->destination_identities = $arr;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.livekit.UserPacket user = 2;</code>
     * @return \Livekit\UserPacket|null
     */
    public function getUser()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Generated from protobuf field <code>.livekit.UserPacket user = 2;</code>
     * @param \Livekit\UserPacket $var
     * @return $this
     */
    public function setUser($var)
    {
        GPBUtil::checkMessage($var, \Livekit\UserPacket::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.livekit.ActiveSpeakerUpdate speaker = 3 [deprecated = true];</code>
     * @return \Livekit\ActiveSpeakerUpdate|null
     * @deprecated
     */
    public function getSpeaker()
    {
        @trigger_error('speaker is deprecated.', E_USER_DEPRECATED);
        return $this->readOneof(3);
    }

    public function hasSpeaker()
    {
        @trigger_error('speaker is deprecated.', E_USER_DEPRECATED);
        return $this->hasOneof(3);
    }

    /**
     * Generated from protobuf field <code>.livekit.ActiveSpeakerUpdate speaker = 3 [deprecated = true];</code>
     * @param \Livekit\ActiveSpeakerUpdate $var
     * @return $this
     * @deprecated
     */
    public function setSpeaker($var)
    {
        @trigger_error('speaker is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkMessage($var, \Livekit\ActiveSpeakerUpdate::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.livekit.SipDTMF sip_dtmf = 6;</code>
     * @return \Livekit\SipDTMF|null
     */
    public function getSipDtmf()
    {
        return $this->readOneof(6);
    }

    public function hasSipDtmf()
    {
        return $this->hasOneof(6);
    }

    /**
     * Generated from protobuf field <code>.livekit.SipDTMF sip_dtmf = 6;</code>
     * @param \Livekit\SipDTMF $var
     * @return $this
     */
    public function setSipDtmf($var)
    {
        GPBUtil::checkMessage($var, \Livekit\SipDTMF::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.livekit.Transcription transcription = 7;</code>
     * @return \Livekit\Transcription|null
     */
    public function getTranscription()
    {
        return $this->readOneof(7);
    }

    public function hasTranscription()
    {
        return $this->hasOneof(7);
    }

    /**
     * Generated from protobuf field <code>.livekit.Transcription transcription = 7;</code>
     * @param \Livekit\Transcription $var
     * @return $this
     */
    public function setTranscription($var)
    {
        GPBUtil::checkMessage($var, \Livekit\Transcription::class);
        $this->writeOneof(7, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.livekit.MetricsBatch metrics = 8;</code>
     * @return \Livekit\MetricsBatch|null
     */
    public function getMetrics()
    {
        return $this->readOneof(8);
    }

    public function hasMetrics()
    {
        return $this->hasOneof(8);
    }

    /**
     * Generated from protobuf field <code>.livekit.MetricsBatch metrics = 8;</code>
     * @param \Livekit\MetricsBatch $var
     * @return $this
     */
    public function setMetrics($var)
    {
        GPBUtil::checkMessage($var, \Livekit\MetricsBatch::class);
        $this->writeOneof(8, $var);

        return $this;
    }

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

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

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

        return $this;
    }

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

}

