<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/photos/types/media_item.proto

namespace Google\Photos\Types;

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

/**
 * Metadata for a media item.
 *
 * Generated from protobuf message <code>google.photos.types.MediaMetadata</code>
 */
class MediaMetadata extends \Google\Protobuf\Internal\Message
{
    /**
     * Time when the media item was first created (not when it was uploaded to
     * Google Photos).
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp creation_time = 1;</code>
     */
    protected $creation_time = null;
    /**
     * Original width (in pixels) of the media item.
     *
     * Generated from protobuf field <code>int64 width = 2;</code>
     */
    protected $width = 0;
    /**
     * Original height (in pixels) of the media item.
     *
     * Generated from protobuf field <code>int64 height = 3;</code>
     */
    protected $height = 0;
    protected $metadata;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Timestamp $creation_time
     *           Time when the media item was first created (not when it was uploaded to
     *           Google Photos).
     *     @type int|string $width
     *           Original width (in pixels) of the media item.
     *     @type int|string $height
     *           Original height (in pixels) of the media item.
     *     @type \Google\Photos\Types\Photo $photo
     *           Metadata for a photo media type.
     *     @type \Google\Photos\Types\Video $video
     *           Metadata for a video media type.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Photos\Types\MediaItem::initOnce();
        parent::__construct($data);
    }

    /**
     * Time when the media item was first created (not when it was uploaded to
     * Google Photos).
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp creation_time = 1;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreationTime()
    {
        return isset($this->creation_time) ? $this->creation_time : null;
    }

    public function hasCreationTime()
    {
        return isset($this->creation_time);
    }

    public function clearCreationTime()
    {
        unset($this->creation_time);
    }

    /**
     * Time when the media item was first created (not when it was uploaded to
     * Google Photos).
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp creation_time = 1;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreationTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->creation_time = $var;

        return $this;
    }

    /**
     * Original width (in pixels) of the media item.
     *
     * Generated from protobuf field <code>int64 width = 2;</code>
     * @return int|string
     */
    public function getWidth()
    {
        return $this->width;
    }

    /**
     * Original width (in pixels) of the media item.
     *
     * Generated from protobuf field <code>int64 width = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setWidth($var)
    {
        GPBUtil::checkInt64($var);
        $this->width = $var;

        return $this;
    }

    /**
     * Original height (in pixels) of the media item.
     *
     * Generated from protobuf field <code>int64 height = 3;</code>
     * @return int|string
     */
    public function getHeight()
    {
        return $this->height;
    }

    /**
     * Original height (in pixels) of the media item.
     *
     * Generated from protobuf field <code>int64 height = 3;</code>
     * @param int|string $var
     * @return $this
     */
    public function setHeight($var)
    {
        GPBUtil::checkInt64($var);
        $this->height = $var;

        return $this;
    }

    /**
     * Metadata for a photo media type.
     *
     * Generated from protobuf field <code>.google.photos.types.Photo photo = 6;</code>
     * @return \Google\Photos\Types\Photo|null
     */
    public function getPhoto()
    {
        return $this->readOneof(6);
    }

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

    /**
     * Metadata for a photo media type.
     *
     * Generated from protobuf field <code>.google.photos.types.Photo photo = 6;</code>
     * @param \Google\Photos\Types\Photo $var
     * @return $this
     */
    public function setPhoto($var)
    {
        GPBUtil::checkMessage($var, \Google\Photos\Types\Photo::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Metadata for a video media type.
     *
     * Generated from protobuf field <code>.google.photos.types.Video video = 7;</code>
     * @return \Google\Photos\Types\Video|null
     */
    public function getVideo()
    {
        return $this->readOneof(7);
    }

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

    /**
     * Metadata for a video media type.
     *
     * Generated from protobuf field <code>.google.photos.types.Video video = 7;</code>
     * @param \Google\Photos\Types\Video $var
     * @return $this
     */
    public function setVideo($var)
    {
        GPBUtil::checkMessage($var, \Google\Photos\Types\Video::class);
        $this->writeOneof(7, $var);

        return $this;
    }

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

}

