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

namespace Google\Cloud\Functions\V2;

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

/**
 * The location of the function source code.
 *
 * Generated from protobuf message <code>google.cloud.functions.v2.Source</code>
 */
class Source extends \Google\Protobuf\Internal\Message
{
    protected $source;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Functions\V2\StorageSource $storage_source
     *           If provided, get the source from this location in Google Cloud Storage.
     *     @type \Google\Cloud\Functions\V2\RepoSource $repo_source
     *           If provided, get the source from this location in a Cloud Source
     *           Repository.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Functions\V2\Functions::initOnce();
        parent::__construct($data);
    }

    /**
     * If provided, get the source from this location in Google Cloud Storage.
     *
     * Generated from protobuf field <code>.google.cloud.functions.v2.StorageSource storage_source = 1;</code>
     * @return \Google\Cloud\Functions\V2\StorageSource|null
     */
    public function getStorageSource()
    {
        return $this->readOneof(1);
    }

    public function hasStorageSource()
    {
        return $this->hasOneof(1);
    }

    /**
     * If provided, get the source from this location in Google Cloud Storage.
     *
     * Generated from protobuf field <code>.google.cloud.functions.v2.StorageSource storage_source = 1;</code>
     * @param \Google\Cloud\Functions\V2\StorageSource $var
     * @return $this
     */
    public function setStorageSource($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\StorageSource::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * If provided, get the source from this location in a Cloud Source
     * Repository.
     *
     * Generated from protobuf field <code>.google.cloud.functions.v2.RepoSource repo_source = 2;</code>
     * @return \Google\Cloud\Functions\V2\RepoSource|null
     */
    public function getRepoSource()
    {
        return $this->readOneof(2);
    }

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

    /**
     * If provided, get the source from this location in a Cloud Source
     * Repository.
     *
     * Generated from protobuf field <code>.google.cloud.functions.v2.RepoSource repo_source = 2;</code>
     * @param \Google\Cloud\Functions\V2\RepoSource $var
     * @return $this
     */
    public function setRepoSource($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Functions\V2\RepoSource::class);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

