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

namespace Google\Photos\Library\V1;

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

/**
 * Result of retrieving a media item.
 *
 * Generated from protobuf message <code>google.photos.library.v1.MediaItemResult</code>
 */
class MediaItemResult extends \Google\Protobuf\Internal\Message
{
    /**
     * If an error occurred while accessing this media item, this field
     * is populated with information related to the error. For details regarding
     * this field, see [Status][google.rpc.Status].
     *
     * Generated from protobuf field <code>.google.rpc.Status status = 1;</code>
     */
    protected $status = null;
    /**
     * Media item retrieved from the user's library. It's populated if no errors
     * occurred and the media item was fetched successfully.
     *
     * Generated from protobuf field <code>.google.photos.types.MediaItem media_item = 2;</code>
     */
    protected $media_item = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Rpc\Status $status
     *           If an error occurred while accessing this media item, this field
     *           is populated with information related to the error. For details regarding
     *           this field, see [Status][google.rpc.Status].
     *     @type \Google\Photos\Types\MediaItem $media_item
     *           Media item retrieved from the user's library. It's populated if no errors
     *           occurred and the media item was fetched successfully.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Photos\Library\V1\PhotosLibrary::initOnce();
        parent::__construct($data);
    }

    /**
     * If an error occurred while accessing this media item, this field
     * is populated with information related to the error. For details regarding
     * this field, see [Status][google.rpc.Status].
     *
     * Generated from protobuf field <code>.google.rpc.Status status = 1;</code>
     * @return \Google\Rpc\Status|null
     */
    public function getStatus()
    {
        return isset($this->status) ? $this->status : null;
    }

    public function hasStatus()
    {
        return isset($this->status);
    }

    public function clearStatus()
    {
        unset($this->status);
    }

    /**
     * If an error occurred while accessing this media item, this field
     * is populated with information related to the error. For details regarding
     * this field, see [Status][google.rpc.Status].
     *
     * Generated from protobuf field <code>.google.rpc.Status status = 1;</code>
     * @param \Google\Rpc\Status $var
     * @return $this
     */
    public function setStatus($var)
    {
        GPBUtil::checkMessage($var, \Google\Rpc\Status::class);
        $this->status = $var;

        return $this;
    }

    /**
     * Media item retrieved from the user's library. It's populated if no errors
     * occurred and the media item was fetched successfully.
     *
     * Generated from protobuf field <code>.google.photos.types.MediaItem media_item = 2;</code>
     * @return \Google\Photos\Types\MediaItem|null
     */
    public function getMediaItem()
    {
        return isset($this->media_item) ? $this->media_item : null;
    }

    public function hasMediaItem()
    {
        return isset($this->media_item);
    }

    public function clearMediaItem()
    {
        unset($this->media_item);
    }

    /**
     * Media item retrieved from the user's library. It's populated if no errors
     * occurred and the media item was fetched successfully.
     *
     * Generated from protobuf field <code>.google.photos.types.MediaItem media_item = 2;</code>
     * @param \Google\Photos\Types\MediaItem $var
     * @return $this
     */
    public function setMediaItem($var)
    {
        GPBUtil::checkMessage($var, \Google\Photos\Types\MediaItem::class);
        $this->media_item = $var;

        return $this;
    }

}

