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

namespace Google\Cloud\CloudDms\V1;

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

/**
 * Trigger is not used as an independent entity, it is retrieved as part of a
 * Table entity.
 *
 * Generated from protobuf message <code>google.cloud.clouddms.v1.TriggerEntity</code>
 */
class TriggerEntity extends \Google\Protobuf\Internal\Message
{
    /**
     * The name of the trigger.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    protected $name = '';
    /**
     * The DML, DDL, or database events that fire the trigger, for example
     * INSERT, UPDATE.
     *
     * Generated from protobuf field <code>repeated string triggering_events = 2;</code>
     */
    private $triggering_events;
    /**
     * Indicates when the trigger fires, for example BEFORE STATEMENT, AFTER EACH
     * ROW.
     *
     * Generated from protobuf field <code>string trigger_type = 3;</code>
     */
    protected $trigger_type = '';
    /**
     * The SQL code which creates the trigger.
     *
     * Generated from protobuf field <code>string sql_code = 4;</code>
     */
    protected $sql_code = '';
    /**
     * Custom engine specific features.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct custom_features = 5;</code>
     */
    protected $custom_features = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           The name of the trigger.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $triggering_events
     *           The DML, DDL, or database events that fire the trigger, for example
     *           INSERT, UPDATE.
     *     @type string $trigger_type
     *           Indicates when the trigger fires, for example BEFORE STATEMENT, AFTER EACH
     *           ROW.
     *     @type string $sql_code
     *           The SQL code which creates the trigger.
     *     @type \Google\Protobuf\Struct $custom_features
     *           Custom engine specific features.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Clouddms\V1\ConversionworkspaceResources::initOnce();
        parent::__construct($data);
    }

    /**
     * The name of the trigger.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * The name of the trigger.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The DML, DDL, or database events that fire the trigger, for example
     * INSERT, UPDATE.
     *
     * Generated from protobuf field <code>repeated string triggering_events = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getTriggeringEvents()
    {
        return $this->triggering_events;
    }

    /**
     * The DML, DDL, or database events that fire the trigger, for example
     * INSERT, UPDATE.
     *
     * Generated from protobuf field <code>repeated string triggering_events = 2;</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setTriggeringEvents($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->triggering_events = $arr;

        return $this;
    }

    /**
     * Indicates when the trigger fires, for example BEFORE STATEMENT, AFTER EACH
     * ROW.
     *
     * Generated from protobuf field <code>string trigger_type = 3;</code>
     * @return string
     */
    public function getTriggerType()
    {
        return $this->trigger_type;
    }

    /**
     * Indicates when the trigger fires, for example BEFORE STATEMENT, AFTER EACH
     * ROW.
     *
     * Generated from protobuf field <code>string trigger_type = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setTriggerType($var)
    {
        GPBUtil::checkString($var, True);
        $this->trigger_type = $var;

        return $this;
    }

    /**
     * The SQL code which creates the trigger.
     *
     * Generated from protobuf field <code>string sql_code = 4;</code>
     * @return string
     */
    public function getSqlCode()
    {
        return $this->sql_code;
    }

    /**
     * The SQL code which creates the trigger.
     *
     * Generated from protobuf field <code>string sql_code = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setSqlCode($var)
    {
        GPBUtil::checkString($var, True);
        $this->sql_code = $var;

        return $this;
    }

    /**
     * Custom engine specific features.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct custom_features = 5;</code>
     * @return \Google\Protobuf\Struct|null
     */
    public function getCustomFeatures()
    {
        return $this->custom_features;
    }

    public function hasCustomFeatures()
    {
        return isset($this->custom_features);
    }

    public function clearCustomFeatures()
    {
        unset($this->custom_features);
    }

    /**
     * Custom engine specific features.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct custom_features = 5;</code>
     * @param \Google\Protobuf\Struct $var
     * @return $this
     */
    public function setCustomFeatures($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
        $this->custom_features = $var;

        return $this;
    }

}

