<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/video/stitcher/v1/live_configs.proto

namespace Google\Cloud\Video\Stitcher\V1;

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

/**
 * The configuration for prefetch ads.
 *
 * Generated from protobuf message <code>google.cloud.video.stitcher.v1.PrefetchConfig</code>
 */
class PrefetchConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Indicates whether the option to prefetch ad requests is enabled.
     *
     * Generated from protobuf field <code>bool enabled = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $enabled = false;
    /**
     * The duration in seconds of the part of the break to be prefetched.
     * This field is only relevant if prefetch is enabled.
     * You should set this duration to as long as possible to increase the
     * benefits of prefetching, but not longer than the shortest ad break
     * expected. For example, for a live event with 30s and 60s ad breaks, the
     * initial duration should be set to 30s.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration initial_ad_request_duration = 2;</code>
     */
    private $initial_ad_request_duration = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type bool $enabled
     *           Required. Indicates whether the option to prefetch ad requests is enabled.
     *     @type \Google\Protobuf\Duration $initial_ad_request_duration
     *           The duration in seconds of the part of the break to be prefetched.
     *           This field is only relevant if prefetch is enabled.
     *           You should set this duration to as long as possible to increase the
     *           benefits of prefetching, but not longer than the shortest ad break
     *           expected. For example, for a live event with 30s and 60s ad breaks, the
     *           initial duration should be set to 30s.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Indicates whether the option to prefetch ad requests is enabled.
     *
     * Generated from protobuf field <code>bool enabled = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return bool
     */
    public function getEnabled()
    {
        return $this->enabled;
    }

    /**
     * Required. Indicates whether the option to prefetch ad requests is enabled.
     *
     * Generated from protobuf field <code>bool enabled = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param bool $var
     * @return $this
     */
    public function setEnabled($var)
    {
        GPBUtil::checkBool($var);
        $this->enabled = $var;

        return $this;
    }

    /**
     * The duration in seconds of the part of the break to be prefetched.
     * This field is only relevant if prefetch is enabled.
     * You should set this duration to as long as possible to increase the
     * benefits of prefetching, but not longer than the shortest ad break
     * expected. For example, for a live event with 30s and 60s ad breaks, the
     * initial duration should be set to 30s.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration initial_ad_request_duration = 2;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getInitialAdRequestDuration()
    {
        return $this->initial_ad_request_duration;
    }

    public function hasInitialAdRequestDuration()
    {
        return isset($this->initial_ad_request_duration);
    }

    public function clearInitialAdRequestDuration()
    {
        unset($this->initial_ad_request_duration);
    }

    /**
     * The duration in seconds of the part of the break to be prefetched.
     * This field is only relevant if prefetch is enabled.
     * You should set this duration to as long as possible to increase the
     * benefits of prefetching, but not longer than the shortest ad break
     * expected. For example, for a live event with 30s and 60s ad breaks, the
     * initial duration should be set to 30s.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration initial_ad_request_duration = 2;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setInitialAdRequestDuration($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->initial_ad_request_duration = $var;

        return $this;
    }

}

