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

namespace Google\Cloud\VideoIntelligence\V1;

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

/**
 * Video segment level annotation results for text detection.
 *
 * Generated from protobuf message <code>google.cloud.videointelligence.v1.TextSegment</code>
 */
class TextSegment extends \Google\Protobuf\Internal\Message
{
    /**
     * Video segment where a text snippet was detected.
     *
     * Generated from protobuf field <code>.google.cloud.videointelligence.v1.VideoSegment segment = 1;</code>
     */
    private $segment = null;
    /**
     * Confidence for the track of detected text. It is calculated as the highest
     * over all frames where OCR detected text appears.
     *
     * Generated from protobuf field <code>float confidence = 2;</code>
     */
    private $confidence = 0.0;
    /**
     * Information related to the frames where OCR detected text appears.
     *
     * Generated from protobuf field <code>repeated .google.cloud.videointelligence.v1.TextFrame frames = 3;</code>
     */
    private $frames;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment
     *           Video segment where a text snippet was detected.
     *     @type float $confidence
     *           Confidence for the track of detected text. It is calculated as the highest
     *           over all frames where OCR detected text appears.
     *     @type array<\Google\Cloud\VideoIntelligence\V1\TextFrame>|\Google\Protobuf\Internal\RepeatedField $frames
     *           Information related to the frames where OCR detected text appears.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce();
        parent::__construct($data);
    }

    /**
     * Video segment where a text snippet was detected.
     *
     * Generated from protobuf field <code>.google.cloud.videointelligence.v1.VideoSegment segment = 1;</code>
     * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null
     */
    public function getSegment()
    {
        return $this->segment;
    }

    public function hasSegment()
    {
        return isset($this->segment);
    }

    public function clearSegment()
    {
        unset($this->segment);
    }

    /**
     * Video segment where a text snippet was detected.
     *
     * Generated from protobuf field <code>.google.cloud.videointelligence.v1.VideoSegment segment = 1;</code>
     * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var
     * @return $this
     */
    public function setSegment($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class);
        $this->segment = $var;

        return $this;
    }

    /**
     * Confidence for the track of detected text. It is calculated as the highest
     * over all frames where OCR detected text appears.
     *
     * Generated from protobuf field <code>float confidence = 2;</code>
     * @return float
     */
    public function getConfidence()
    {
        return $this->confidence;
    }

    /**
     * Confidence for the track of detected text. It is calculated as the highest
     * over all frames where OCR detected text appears.
     *
     * Generated from protobuf field <code>float confidence = 2;</code>
     * @param float $var
     * @return $this
     */
    public function setConfidence($var)
    {
        GPBUtil::checkFloat($var);
        $this->confidence = $var;

        return $this;
    }

    /**
     * Information related to the frames where OCR detected text appears.
     *
     * Generated from protobuf field <code>repeated .google.cloud.videointelligence.v1.TextFrame frames = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getFrames()
    {
        return $this->frames;
    }

    /**
     * Information related to the frames where OCR detected text appears.
     *
     * Generated from protobuf field <code>repeated .google.cloud.videointelligence.v1.TextFrame frames = 3;</code>
     * @param array<\Google\Cloud\VideoIntelligence\V1\TextFrame>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setFrames($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\TextFrame::class);
        $this->frames = $arr;

        return $this;
    }

}

