<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/dialogflow/cx/v3/playbook.proto

namespace Google\Cloud\Dialogflow\Cx\V3\Handler;

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

/**
 * A handler that is triggered by the specified
 * [event][google.cloud.dialogflow.cx.v3.Handler.EventHandler.event].
 *
 * Generated from protobuf message <code>google.cloud.dialogflow.cx.v3.Handler.EventHandler</code>
 */
class EventHandler extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The name of the event that triggers this handler.
     *
     * Generated from protobuf field <code>string event = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $event = '';
    /**
     * Optional. The condition that must be satisfied to trigger this handler.
     *
     * Generated from protobuf field <code>string condition = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $condition = '';
    /**
     * Required. The fulfillment to call when the event occurs.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $fulfillment = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $event
     *           Required. The name of the event that triggers this handler.
     *     @type string $condition
     *           Optional. The condition that must be satisfied to trigger this handler.
     *     @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $fulfillment
     *           Required. The fulfillment to call when the event occurs.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The name of the event that triggers this handler.
     *
     * Generated from protobuf field <code>string event = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getEvent()
    {
        return $this->event;
    }

    /**
     * Required. The name of the event that triggers this handler.
     *
     * Generated from protobuf field <code>string event = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setEvent($var)
    {
        GPBUtil::checkString($var, True);
        $this->event = $var;

        return $this;
    }

    /**
     * Optional. The condition that must be satisfied to trigger this handler.
     *
     * Generated from protobuf field <code>string condition = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getCondition()
    {
        return $this->condition;
    }

    /**
     * Optional. The condition that must be satisfied to trigger this handler.
     *
     * Generated from protobuf field <code>string condition = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setCondition($var)
    {
        GPBUtil::checkString($var, True);
        $this->condition = $var;

        return $this;
    }

    /**
     * Required. The fulfillment to call when the event occurs.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment|null
     */
    public function getFulfillment()
    {
        return $this->fulfillment;
    }

    public function hasFulfillment()
    {
        return isset($this->fulfillment);
    }

    public function clearFulfillment()
    {
        unset($this->fulfillment);
    }

    /**
     * Required. The fulfillment to call when the event occurs.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $var
     * @return $this
     */
    public function setFulfillment($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment::class);
        $this->fulfillment = $var;

        return $this;
    }

}

