<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/discoveryengine/v1beta/user_event.proto

namespace Google\Cloud\DiscoveryEngine\V1beta;

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

/**
 * Media-specific user event information.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1beta.MediaInfo</code>
 */
class MediaInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * The media progress time in seconds, if applicable.
     * For example, if the end user has finished 90 seconds of a playback video,
     * then [MediaInfo.media_progress_duration.seconds][Duration.seconds] should
     * be set to 90.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration media_progress_duration = 1;</code>
     */
    protected $media_progress_duration = null;
    /**
     * Media progress should be computed using only the media_progress_duration
     * relative to the media total length.
     * This value must be between `[0, 1.0]` inclusive.
     * If this is not a playback or the progress cannot be computed (e.g. ongoing
     * livestream), this field should be unset.
     *
     * Generated from protobuf field <code>optional float media_progress_percentage = 2;</code>
     */
    protected $media_progress_percentage = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Duration $media_progress_duration
     *           The media progress time in seconds, if applicable.
     *           For example, if the end user has finished 90 seconds of a playback video,
     *           then [MediaInfo.media_progress_duration.seconds][Duration.seconds] should
     *           be set to 90.
     *     @type float $media_progress_percentage
     *           Media progress should be computed using only the media_progress_duration
     *           relative to the media total length.
     *           This value must be between `[0, 1.0]` inclusive.
     *           If this is not a playback or the progress cannot be computed (e.g. ongoing
     *           livestream), this field should be unset.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\UserEvent::initOnce();
        parent::__construct($data);
    }

    /**
     * The media progress time in seconds, if applicable.
     * For example, if the end user has finished 90 seconds of a playback video,
     * then [MediaInfo.media_progress_duration.seconds][Duration.seconds] should
     * be set to 90.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration media_progress_duration = 1;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getMediaProgressDuration()
    {
        return $this->media_progress_duration;
    }

    public function hasMediaProgressDuration()
    {
        return isset($this->media_progress_duration);
    }

    public function clearMediaProgressDuration()
    {
        unset($this->media_progress_duration);
    }

    /**
     * The media progress time in seconds, if applicable.
     * For example, if the end user has finished 90 seconds of a playback video,
     * then [MediaInfo.media_progress_duration.seconds][Duration.seconds] should
     * be set to 90.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration media_progress_duration = 1;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setMediaProgressDuration($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->media_progress_duration = $var;

        return $this;
    }

    /**
     * Media progress should be computed using only the media_progress_duration
     * relative to the media total length.
     * This value must be between `[0, 1.0]` inclusive.
     * If this is not a playback or the progress cannot be computed (e.g. ongoing
     * livestream), this field should be unset.
     *
     * Generated from protobuf field <code>optional float media_progress_percentage = 2;</code>
     * @return float
     */
    public function getMediaProgressPercentage()
    {
        return isset($this->media_progress_percentage) ? $this->media_progress_percentage : 0.0;
    }

    public function hasMediaProgressPercentage()
    {
        return isset($this->media_progress_percentage);
    }

    public function clearMediaProgressPercentage()
    {
        unset($this->media_progress_percentage);
    }

    /**
     * Media progress should be computed using only the media_progress_duration
     * relative to the media total length.
     * This value must be between `[0, 1.0]` inclusive.
     * If this is not a playback or the progress cannot be computed (e.g. ongoing
     * livestream), this field should be unset.
     *
     * Generated from protobuf field <code>optional float media_progress_percentage = 2;</code>
     * @param float $var
     * @return $this
     */
    public function setMediaProgressPercentage($var)
    {
        GPBUtil::checkFloat($var);
        $this->media_progress_percentage = $var;

        return $this;
    }

}

