<?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\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The request message for the CreateTrigger method.
 *
 * Generated from protobuf message <code>google.cloud.eventarc.v1.CreateTriggerRequest</code>
 */
class CreateTriggerRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The parent collection in which to add this trigger.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $parent = '';
    /**
     * Required. The trigger to create.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $trigger = null;
    /**
     * Required. The user-provided ID to be assigned to the trigger.
     *
     * Generated from protobuf field <code>string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $trigger_id = '';
    /**
     * Required. 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) = REQUIRED];</code>
     */
    protected $validate_only = false;

    /**
     * @param string                            $parent    Required. The parent collection in which to add this trigger. Please see
     *                                                     {@see EventarcClient::locationName()} for help formatting this field.
     * @param \Google\Cloud\Eventarc\V1\Trigger $trigger   Required. The trigger to create.
     * @param string                            $triggerId Required. The user-provided ID to be assigned to the trigger.
     *
     * @return \Google\Cloud\Eventarc\V1\CreateTriggerRequest
     *
     * @experimental
     */
    public static function build(string $parent, \Google\Cloud\Eventarc\V1\Trigger $trigger, string $triggerId): self
    {
        return (new self())
            ->setParent($parent)
            ->setTrigger($trigger)
            ->setTriggerId($triggerId);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The parent collection in which to add this trigger.
     *     @type \Google\Cloud\Eventarc\V1\Trigger $trigger
     *           Required. The trigger to create.
     *     @type string $trigger_id
     *           Required. The user-provided ID to be assigned to the trigger.
     *     @type bool $validate_only
     *           Required. 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 trigger.
     *
     * 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 trigger.
     *
     * 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 trigger to create.
     *
     * Generated from protobuf field <code>.google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Eventarc\V1\Trigger|null
     */
    public function getTrigger()
    {
        return $this->trigger;
    }

    public function hasTrigger()
    {
        return isset($this->trigger);
    }

    public function clearTrigger()
    {
        unset($this->trigger);
    }

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

        return $this;
    }

    /**
     * Required. The user-provided ID to be assigned to the trigger.
     *
     * Generated from protobuf field <code>string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getTriggerId()
    {
        return $this->trigger_id;
    }

    /**
     * Required. The user-provided ID to be assigned to the trigger.
     *
     * Generated from protobuf field <code>string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setTriggerId($var)
    {
        GPBUtil::checkString($var, True);
        $this->trigger_id = $var;

        return $this;
    }

    /**
     * Required. 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) = REQUIRED];</code>
     * @return bool
     */
    public function getValidateOnly()
    {
        return $this->validate_only;
    }

    /**
     * Required. 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) = REQUIRED];</code>
     * @param bool $var
     * @return $this
     */
    public function setValidateOnly($var)
    {
        GPBUtil::checkBool($var);
        $this->validate_only = $var;

        return $this;
    }

}

