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

namespace Google\Cloud\BigQuery\AnalyticsHub\V1;

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

/**
 * All supported message transforms types.
 *
 * Generated from protobuf message <code>google.cloud.bigquery.analyticshub.v1.MessageTransform</code>
 */
class MessageTransform extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. This field is deprecated, use the `disabled` field to disable
     * transforms.
     *
     * Generated from protobuf field <code>bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];</code>
     * @deprecated
     */
    protected $enabled = false;
    /**
     * Optional. If true, the transform is disabled and will not be applied to
     * messages. Defaults to `false`.
     *
     * Generated from protobuf field <code>bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $disabled = false;
    protected $transform;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\BigQuery\AnalyticsHub\V1\JavaScriptUDF $javascript_udf
     *           Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     *           are specified on a resource, each must have a unique `function_name`.
     *     @type bool $enabled
     *           Optional. This field is deprecated, use the `disabled` field to disable
     *           transforms.
     *     @type bool $disabled
     *           Optional. If true, the transform is disabled and will not be applied to
     *           messages. Defaults to `false`.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Bigquery\Analyticshub\V1\Pubsub::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.analyticshub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\BigQuery\AnalyticsHub\V1\JavaScriptUDF|null
     */
    public function getJavascriptUdf()
    {
        return $this->readOneof(2);
    }

    public function hasJavascriptUdf()
    {
        return $this->hasOneof(2);
    }

    /**
     * Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
     * are specified on a resource, each must have a unique `function_name`.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.analyticshub.v1.JavaScriptUDF javascript_udf = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\BigQuery\AnalyticsHub\V1\JavaScriptUDF $var
     * @return $this
     */
    public function setJavascriptUdf($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\AnalyticsHub\V1\JavaScriptUDF::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Optional. This field is deprecated, use the `disabled` field to disable
     * transforms.
     *
     * Generated from protobuf field <code>bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];</code>
     * @return bool
     * @deprecated
     */
    public function getEnabled()
    {
        if ($this->enabled !== false) {
            @trigger_error('enabled is deprecated.', E_USER_DEPRECATED);
        }
        return $this->enabled;
    }

    /**
     * Optional. This field is deprecated, use the `disabled` field to disable
     * transforms.
     *
     * Generated from protobuf field <code>bool enabled = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL];</code>
     * @param bool $var
     * @return $this
     * @deprecated
     */
    public function setEnabled($var)
    {
        @trigger_error('enabled is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkBool($var);
        $this->enabled = $var;

        return $this;
    }

    /**
     * Optional. If true, the transform is disabled and will not be applied to
     * messages. Defaults to `false`.
     *
     * Generated from protobuf field <code>bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return bool
     */
    public function getDisabled()
    {
        return $this->disabled;
    }

    /**
     * Optional. If true, the transform is disabled and will not be applied to
     * messages. Defaults to `false`.
     *
     * Generated from protobuf field <code>bool disabled = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param bool $var
     * @return $this
     */
    public function setDisabled($var)
    {
        GPBUtil::checkBool($var);
        $this->disabled = $var;

        return $this;
    }

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

}

