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

namespace Google\Cloud\Dialogflow\Cx\V3;

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

/**
 * Handler can be used to define custom logic to be executed based on the
 * user-specified triggers.
 *
 * Generated from protobuf message <code>google.cloud.dialogflow.cx.v3.Handler</code>
 */
class Handler extends \Google\Protobuf\Internal\Message
{
    protected $handler;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler $event_handler
     *           A handler triggered by event.
     *     @type \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler $lifecycle_handler
     *           A handler triggered during specific lifecycle of the playbook execution.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce();
        parent::__construct($data);
    }

    /**
     * A handler triggered by event.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.Handler.EventHandler event_handler = 1;</code>
     * @return \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler|null
     */
    public function getEventHandler()
    {
        return $this->readOneof(1);
    }

    public function hasEventHandler()
    {
        return $this->hasOneof(1);
    }

    /**
     * A handler triggered by event.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.Handler.EventHandler event_handler = 1;</code>
     * @param \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler $var
     * @return $this
     */
    public function setEventHandler($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * A handler triggered during specific lifecycle of the playbook execution.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.Handler.LifecycleHandler lifecycle_handler = 3;</code>
     * @return \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler|null
     */
    public function getLifecycleHandler()
    {
        return $this->readOneof(3);
    }

    public function hasLifecycleHandler()
    {
        return $this->hasOneof(3);
    }

    /**
     * A handler triggered during specific lifecycle of the playbook execution.
     *
     * Generated from protobuf field <code>.google.cloud.dialogflow.cx.v3.Handler.LifecycleHandler lifecycle_handler = 3;</code>
     * @param \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler $var
     * @return $this
     */
    public function setLifecycleHandler($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getHandler()
    {
        return $this->whichOneof("handler");
    }

}

