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

namespace Google\Cloud\ApiGateway\V1;

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

/**
 * Request message for ApiGatewayService.CreateApi
 *
 * Generated from protobuf message <code>google.cloud.apigateway.v1.CreateApiRequest</code>
 */
class CreateApiRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Parent resource of the API, of the form:
     * `projects/&#42;&#47;locations/global`
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    private $parent = '';
    /**
     * Required. Identifier to assign to the API. Must be unique within scope of
     * the parent resource.
     *
     * Generated from protobuf field <code>string api_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $api_id = '';
    /**
     * Required. API resource.
     *
     * Generated from protobuf field <code>.google.cloud.apigateway.v1.Api api = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $api = null;

    /**
     * @param string                          $parent Required. Parent resource of the API, of the form:
     *                                                `projects/&#42;/locations/global`
     *                                                Please see {@see ApiGatewayServiceClient::locationName()} for help formatting this field.
     * @param \Google\Cloud\ApiGateway\V1\Api $api    Required. API resource.
     * @param string                          $apiId  Required. Identifier to assign to the API. Must be unique within scope of
     *                                                the parent resource.
     *
     * @return \Google\Cloud\ApiGateway\V1\CreateApiRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Cloud\ApiGateway\V1\Api $api, string $apiId): self
    {
        return (new self())
            ->setParent($parent)
            ->setApi($api)
            ->setApiId($apiId);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. Parent resource of the API, of the form:
     *           `projects/&#42;&#47;locations/global`
     *     @type string $api_id
     *           Required. Identifier to assign to the API. Must be unique within scope of
     *           the parent resource.
     *     @type \Google\Cloud\ApiGateway\V1\Api $api
     *           Required. API resource.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Apigateway\V1\Apigateway::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Parent resource of the API, of the form:
     * `projects/&#42;&#47;locations/global`
     *
     * 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. Parent resource of the API, of the form:
     * `projects/&#42;&#47;locations/global`
     *
     * 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;
    }

    /**
     * Required. Identifier to assign to the API. Must be unique within scope of
     * the parent resource.
     *
     * Generated from protobuf field <code>string api_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getApiId()
    {
        return $this->api_id;
    }

    /**
     * Required. Identifier to assign to the API. Must be unique within scope of
     * the parent resource.
     *
     * Generated from protobuf field <code>string api_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setApiId($var)
    {
        GPBUtil::checkString($var, True);
        $this->api_id = $var;

        return $this;
    }

    /**
     * Required. API resource.
     *
     * Generated from protobuf field <code>.google.cloud.apigateway.v1.Api api = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\ApiGateway\V1\Api|null
     */
    public function getApi()
    {
        return $this->api;
    }

    public function hasApi()
    {
        return isset($this->api);
    }

    public function clearApi()
    {
        unset($this->api);
    }

    /**
     * Required. API resource.
     *
     * Generated from protobuf field <code>.google.cloud.apigateway.v1.Api api = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\ApiGateway\V1\Api $var
     * @return $this
     */
    public function setApi($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\ApiGateway\V1\Api::class);
        $this->api = $var;

        return $this;
    }

}

