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

namespace Livekit;

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

/**
 * Generated from protobuf message <code>livekit.SIPMediaConfig</code>
 */
class SIPMediaConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * if set, ignore the default codecs and use the list below.
     *
     * Generated from protobuf field <code>bool only_listed_codecs = 1;</code>
     */
    protected $only_listed_codecs = false;
    /**
     * List of allowed codecs. If only_listed_codecs is not set, this list is added to default codecs.
     *
     * Generated from protobuf field <code>repeated .livekit.SIPCodec codecs = 2;</code>
     */
    private $codecs;
    /**
     * Generated from protobuf field <code>optional .livekit.SIPMediaEncryption encryption = 3;</code>
     */
    protected $encryption = null;
    /**
     * Use specific media timeout. If zero or not specified, will use default timeout.
     *
     * Generated from protobuf field <code>optional .google.protobuf.Duration media_timeout = 4;</code>
     */
    protected $media_timeout = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type bool $only_listed_codecs
     *           if set, ignore the default codecs and use the list below.
     *     @type \Livekit\SIPCodec[] $codecs
     *           List of allowed codecs. If only_listed_codecs is not set, this list is added to default codecs.
     *     @type int $encryption
     *     @type \Google\Protobuf\Duration $media_timeout
     *           Use specific media timeout. If zero or not specified, will use default timeout.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\LivekitSip::initOnce();
        parent::__construct($data);
    }

    /**
     * if set, ignore the default codecs and use the list below.
     *
     * Generated from protobuf field <code>bool only_listed_codecs = 1;</code>
     * @return bool
     */
    public function getOnlyListedCodecs()
    {
        return $this->only_listed_codecs;
    }

    /**
     * if set, ignore the default codecs and use the list below.
     *
     * Generated from protobuf field <code>bool only_listed_codecs = 1;</code>
     * @param bool $var
     * @return $this
     */
    public function setOnlyListedCodecs($var)
    {
        GPBUtil::checkBool($var);
        $this->only_listed_codecs = $var;

        return $this;
    }

    /**
     * List of allowed codecs. If only_listed_codecs is not set, this list is added to default codecs.
     *
     * Generated from protobuf field <code>repeated .livekit.SIPCodec codecs = 2;</code>
     * @return RepeatedField<\Livekit\SIPCodec>
     */
    public function getCodecs()
    {
        return $this->codecs;
    }

    /**
     * List of allowed codecs. If only_listed_codecs is not set, this list is added to default codecs.
     *
     * Generated from protobuf field <code>repeated .livekit.SIPCodec codecs = 2;</code>
     * @param \Livekit\SIPCodec[] $var
     * @return $this
     */
    public function setCodecs($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Livekit\SIPCodec::class);
        $this->codecs = $arr;

        return $this;
    }

    /**
     * Generated from protobuf field <code>optional .livekit.SIPMediaEncryption encryption = 3;</code>
     * @return int
     */
    public function getEncryption()
    {
        return isset($this->encryption) ? $this->encryption : 0;
    }

    public function hasEncryption()
    {
        return isset($this->encryption);
    }

    public function clearEncryption()
    {
        unset($this->encryption);
    }

    /**
     * Generated from protobuf field <code>optional .livekit.SIPMediaEncryption encryption = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setEncryption($var)
    {
        GPBUtil::checkEnum($var, \Livekit\SIPMediaEncryption::class);
        $this->encryption = $var;

        return $this;
    }

    /**
     * Use specific media timeout. If zero or not specified, will use default timeout.
     *
     * Generated from protobuf field <code>optional .google.protobuf.Duration media_timeout = 4;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getMediaTimeout()
    {
        return $this->media_timeout;
    }

    public function hasMediaTimeout()
    {
        return isset($this->media_timeout);
    }

    public function clearMediaTimeout()
    {
        unset($this->media_timeout);
    }

    /**
     * Use specific media timeout. If zero or not specified, will use default timeout.
     *
     * Generated from protobuf field <code>optional .google.protobuf.Duration media_timeout = 4;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setMediaTimeout($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->media_timeout = $var;

        return $this;
    }

}

