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

namespace Google\Cloud\Eventarc\V1;

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

/**
 * The request message for the CreateEnrollment method.
 *
 * Generated from protobuf message <code>google.cloud.eventarc.v1.CreateEnrollmentRequest</code>
 */
class CreateEnrollmentRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The parent collection in which to add this enrollment.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $parent = '';
    /**
     * Required. The enrollment to create.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Enrollment enrollment = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $enrollment = null;
    /**
     * Required. The user-provided ID to be assigned to the Enrollment. It should
     * match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *
     * Generated from protobuf field <code>string enrollment_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $enrollment_id = '';
    /**
     * Optional. If set, validate the request and preview the review, but do not
     * post it.
     *
     * Generated from protobuf field <code>bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $validate_only = false;

    /**
     * @param string                               $parent       Required. The parent collection in which to add this enrollment. Please see
     *                                                           {@see EventarcClient::locationName()} for help formatting this field.
     * @param \Google\Cloud\Eventarc\V1\Enrollment $enrollment   Required. The enrollment to create.
     * @param string                               $enrollmentId Required. The user-provided ID to be assigned to the Enrollment. It should
     *                                                           match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *
     * @return \Google\Cloud\Eventarc\V1\CreateEnrollmentRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Cloud\Eventarc\V1\Enrollment $enrollment, string $enrollmentId): self
    {
        return (new self())
            ->setParent($parent)
            ->setEnrollment($enrollment)
            ->setEnrollmentId($enrollmentId);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The parent collection in which to add this enrollment.
     *     @type \Google\Cloud\Eventarc\V1\Enrollment $enrollment
     *           Required. The enrollment to create.
     *     @type string $enrollment_id
     *           Required. The user-provided ID to be assigned to the Enrollment. It should
     *           match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *     @type bool $validate_only
     *           Optional. If set, validate the request and preview the review, but do not
     *           post it.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Eventarc\V1\Eventarc::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The parent collection in which to add this enrollment.
     *
     * 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 parent collection in which to add this enrollment.
     *
     * 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. The enrollment to create.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Enrollment enrollment = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Eventarc\V1\Enrollment|null
     */
    public function getEnrollment()
    {
        return $this->enrollment;
    }

    public function hasEnrollment()
    {
        return isset($this->enrollment);
    }

    public function clearEnrollment()
    {
        unset($this->enrollment);
    }

    /**
     * Required. The enrollment to create.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Enrollment enrollment = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Eventarc\V1\Enrollment $var
     * @return $this
     */
    public function setEnrollment($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Eventarc\V1\Enrollment::class);
        $this->enrollment = $var;

        return $this;
    }

    /**
     * Required. The user-provided ID to be assigned to the Enrollment. It should
     * match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *
     * Generated from protobuf field <code>string enrollment_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getEnrollmentId()
    {
        return $this->enrollment_id;
    }

    /**
     * Required. The user-provided ID to be assigned to the Enrollment. It should
     * match the format `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *
     * Generated from protobuf field <code>string enrollment_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setEnrollmentId($var)
    {
        GPBUtil::checkString($var, True);
        $this->enrollment_id = $var;

        return $this;
    }

    /**
     * Optional. If set, validate the request and preview the review, but do not
     * post it.
     *
     * Generated from protobuf field <code>bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return bool
     */
    public function getValidateOnly()
    {
        return $this->validate_only;
    }

    /**
     * Optional. If set, validate the request and preview the review, but do not
     * post it.
     *
     * Generated from protobuf field <code>bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param bool $var
     * @return $this
     */
    public function setValidateOnly($var)
    {
        GPBUtil::checkBool($var);
        $this->validate_only = $var;

        return $this;
    }

}

