<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/datalabeling/v1beta1/dataset.proto

namespace Google\Cloud\DataLabeling\V1beta1;

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

/**
 * An Example is a piece of data and its annotation. For example, an image with
 * label "house".
 *
 * Generated from protobuf message <code>google.cloud.datalabeling.v1beta1.Example</code>
 */
class Example extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. Name of the example, in format of:
     * projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
     * {annotated_dataset_id}/examples/{example_id}
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * Output only. Annotations for the piece of data in Example.
     * One piece of data can have multiple annotations.
     *
     * Generated from protobuf field <code>repeated .google.cloud.datalabeling.v1beta1.Annotation annotations = 5;</code>
     */
    private $annotations;
    protected $payload;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\DataLabeling\V1beta1\ImagePayload $image_payload
     *           The image payload, a container of the image bytes/uri.
     *     @type \Google\Cloud\DataLabeling\V1beta1\TextPayload $text_payload
     *           The text payload, a container of the text content.
     *     @type \Google\Cloud\DataLabeling\V1beta1\VideoPayload $video_payload
     *           The video payload, a container of the video uri.
     *     @type string $name
     *           Output only. Name of the example, in format of:
     *           projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
     *           {annotated_dataset_id}/examples/{example_id}
     *     @type \Google\Cloud\DataLabeling\V1beta1\Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotations
     *           Output only. Annotations for the piece of data in Example.
     *           One piece of data can have multiple annotations.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Datalabeling\V1Beta1\Dataset::initOnce();
        parent::__construct($data);
    }

    /**
     * The image payload, a container of the image bytes/uri.
     *
     * Generated from protobuf field <code>.google.cloud.datalabeling.v1beta1.ImagePayload image_payload = 2;</code>
     * @return \Google\Cloud\DataLabeling\V1beta1\ImagePayload|null
     */
    public function getImagePayload()
    {
        return $this->readOneof(2);
    }

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

    /**
     * The image payload, a container of the image bytes/uri.
     *
     * Generated from protobuf field <code>.google.cloud.datalabeling.v1beta1.ImagePayload image_payload = 2;</code>
     * @param \Google\Cloud\DataLabeling\V1beta1\ImagePayload $var
     * @return $this
     */
    public function setImagePayload($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\DataLabeling\V1beta1\ImagePayload::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * The text payload, a container of the text content.
     *
     * Generated from protobuf field <code>.google.cloud.datalabeling.v1beta1.TextPayload text_payload = 6;</code>
     * @return \Google\Cloud\DataLabeling\V1beta1\TextPayload|null
     */
    public function getTextPayload()
    {
        return $this->readOneof(6);
    }

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

    /**
     * The text payload, a container of the text content.
     *
     * Generated from protobuf field <code>.google.cloud.datalabeling.v1beta1.TextPayload text_payload = 6;</code>
     * @param \Google\Cloud\DataLabeling\V1beta1\TextPayload $var
     * @return $this
     */
    public function setTextPayload($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\DataLabeling\V1beta1\TextPayload::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * The video payload, a container of the video uri.
     *
     * Generated from protobuf field <code>.google.cloud.datalabeling.v1beta1.VideoPayload video_payload = 7;</code>
     * @return \Google\Cloud\DataLabeling\V1beta1\VideoPayload|null
     */
    public function getVideoPayload()
    {
        return $this->readOneof(7);
    }

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

    /**
     * The video payload, a container of the video uri.
     *
     * Generated from protobuf field <code>.google.cloud.datalabeling.v1beta1.VideoPayload video_payload = 7;</code>
     * @param \Google\Cloud\DataLabeling\V1beta1\VideoPayload $var
     * @return $this
     */
    public function setVideoPayload($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\DataLabeling\V1beta1\VideoPayload::class);
        $this->writeOneof(7, $var);

        return $this;
    }

    /**
     * Output only. Name of the example, in format of:
     * projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
     * {annotated_dataset_id}/examples/{example_id}
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. Name of the example, in format of:
     * projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/
     * {annotated_dataset_id}/examples/{example_id}
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Output only. Annotations for the piece of data in Example.
     * One piece of data can have multiple annotations.
     *
     * Generated from protobuf field <code>repeated .google.cloud.datalabeling.v1beta1.Annotation annotations = 5;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getAnnotations()
    {
        return $this->annotations;
    }

    /**
     * Output only. Annotations for the piece of data in Example.
     * One piece of data can have multiple annotations.
     *
     * Generated from protobuf field <code>repeated .google.cloud.datalabeling.v1beta1.Annotation annotations = 5;</code>
     * @param \Google\Cloud\DataLabeling\V1beta1\Annotation[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setAnnotations($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DataLabeling\V1beta1\Annotation::class);
        $this->annotations = $arr;

        return $this;
    }

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

}

