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

namespace Google\Cloud\Ces\V1;

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

/**
 * Request message for
 * [AgentService.CreateApp][google.cloud.ces.v1.AgentService.CreateApp].
 *
 * Generated from protobuf message <code>google.cloud.ces.v1.CreateAppRequest</code>
 */
class CreateAppRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The resource name of the location to create an app in.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $parent = '';
    /**
     * Optional. The ID to use for the app, which will become the final component
     * of the app's resource name. If not provided, a unique ID will be
     * automatically assigned for the app.
     *
     * Generated from protobuf field <code>string app_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $app_id = '';
    /**
     * Required. The app to create.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.App app = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $app = null;

    /**
     * @param string                   $parent Required. The resource name of the location to create an app in. Please see
     *                                         {@see AgentServiceClient::locationName()} for help formatting this field.
     * @param \Google\Cloud\Ces\V1\App $app    Required. The app to create.
     * @param string                   $appId  Optional. The ID to use for the app, which will become the final component
     *                                         of the app's resource name. If not provided, a unique ID will be
     *                                         automatically assigned for the app.
     *
     * @return \Google\Cloud\Ces\V1\CreateAppRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Cloud\Ces\V1\App $app, string $appId): self
    {
        return (new self())
            ->setParent($parent)
            ->setApp($app)
            ->setAppId($appId);
    }

    /**
     * @param string                   $parent Required. The resource name of the location to create an app in. Please see
     *                                         {@see AgentServiceClient::locationName()} for help formatting this field.
     * @param \Google\Cloud\Ces\V1\App $app    Required. The app to create.
     *
     * @return \Google\Cloud\Ces\V1\CreateAppRequest
     *
     * @experimental
     */
    public static function buildFromParentApp(string $parent, \Google\Cloud\Ces\V1\App $app): self
    {
        return (new self())
            ->setParent($parent)
            ->setApp($app);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The resource name of the location to create an app in.
     *     @type string $app_id
     *           Optional. The ID to use for the app, which will become the final component
     *           of the app's resource name. If not provided, a unique ID will be
     *           automatically assigned for the app.
     *     @type \Google\Cloud\Ces\V1\App $app
     *           Required. The app to create.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Ces\V1\AgentService::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The resource name of the location to create an app in.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Required. The resource name of the location to create an app in.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setParent($var)
    {
        GPBUtil::checkString($var, True);
        $this->parent = $var;

        return $this;
    }

    /**
     * Optional. The ID to use for the app, which will become the final component
     * of the app's resource name. If not provided, a unique ID will be
     * automatically assigned for the app.
     *
     * Generated from protobuf field <code>string app_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getAppId()
    {
        return $this->app_id;
    }

    /**
     * Optional. The ID to use for the app, which will become the final component
     * of the app's resource name. If not provided, a unique ID will be
     * automatically assigned for the app.
     *
     * Generated from protobuf field <code>string app_id = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setAppId($var)
    {
        GPBUtil::checkString($var, True);
        $this->app_id = $var;

        return $this;
    }

    /**
     * Required. The app to create.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.App app = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Ces\V1\App|null
     */
    public function getApp()
    {
        return $this->app;
    }

    public function hasApp()
    {
        return isset($this->app);
    }

    public function clearApp()
    {
        unset($this->app);
    }

    /**
     * Required. The app to create.
     *
     * Generated from protobuf field <code>.google.cloud.ces.v1.App app = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Ces\V1\App $var
     * @return $this
     */
    public function setApp($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Ces\V1\App::class);
        $this->app = $var;

        return $this;
    }

}

