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

namespace Google\Cloud\Dataform\V1beta1\CompilationResultAction;

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

/**
 * Defines a compiled Data Preparation entity
 *
 * Generated from protobuf message <code>google.cloud.dataform.v1beta1.CompilationResultAction.DataPreparation</code>
 */
class DataPreparation extends \Google\Protobuf\Internal\Message
{
    /**
     * A list of actions that this action depends on.
     *
     * Generated from protobuf field <code>repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1;</code>
     */
    private $dependency_targets;
    /**
     * Whether this action is disabled (i.e. should not be run).
     *
     * Generated from protobuf field <code>bool disabled = 2;</code>
     */
    protected $disabled = false;
    /**
     * Arbitrary, user-defined tags on this action.
     *
     * Generated from protobuf field <code>repeated string tags = 4;</code>
     */
    private $tags;
    protected $definition;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $contents_yaml
     *           The data preparation definition, stored as a YAML string.
     *     @type \Google\Cloud\Dataform\V1beta1\CompilationResultAction\DataPreparation\SqlDefinition $contents_sql
     *           SQL definition for a Data Preparation. Contains a SQL query and
     *           additional context information.
     *     @type \Google\Cloud\Dataform\V1beta1\Target[] $dependency_targets
     *           A list of actions that this action depends on.
     *     @type bool $disabled
     *           Whether this action is disabled (i.e. should not be run).
     *     @type string[] $tags
     *           Arbitrary, user-defined tags on this action.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce();
        parent::__construct($data);
    }

    /**
     * The data preparation definition, stored as a YAML string.
     *
     * Generated from protobuf field <code>string contents_yaml = 5;</code>
     * @return string
     */
    public function getContentsYaml()
    {
        return $this->readOneof(5);
    }

    public function hasContentsYaml()
    {
        return $this->hasOneof(5);
    }

    /**
     * The data preparation definition, stored as a YAML string.
     *
     * Generated from protobuf field <code>string contents_yaml = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setContentsYaml($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * SQL definition for a Data Preparation. Contains a SQL query and
     * additional context information.
     *
     * Generated from protobuf field <code>.google.cloud.dataform.v1beta1.CompilationResultAction.DataPreparation.SqlDefinition contents_sql = 6;</code>
     * @return \Google\Cloud\Dataform\V1beta1\CompilationResultAction\DataPreparation\SqlDefinition|null
     */
    public function getContentsSql()
    {
        return $this->readOneof(6);
    }

    public function hasContentsSql()
    {
        return $this->hasOneof(6);
    }

    /**
     * SQL definition for a Data Preparation. Contains a SQL query and
     * additional context information.
     *
     * Generated from protobuf field <code>.google.cloud.dataform.v1beta1.CompilationResultAction.DataPreparation.SqlDefinition contents_sql = 6;</code>
     * @param \Google\Cloud\Dataform\V1beta1\CompilationResultAction\DataPreparation\SqlDefinition $var
     * @return $this
     */
    public function setContentsSql($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CompilationResultAction\DataPreparation\SqlDefinition::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * A list of actions that this action depends on.
     *
     * Generated from protobuf field <code>repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1;</code>
     * @return RepeatedField<\Google\Cloud\Dataform\V1beta1\Target>
     */
    public function getDependencyTargets()
    {
        return $this->dependency_targets;
    }

    /**
     * A list of actions that this action depends on.
     *
     * Generated from protobuf field <code>repeated .google.cloud.dataform.v1beta1.Target dependency_targets = 1;</code>
     * @param \Google\Cloud\Dataform\V1beta1\Target[] $var
     * @return $this
     */
    public function setDependencyTargets($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\Target::class);
        $this->dependency_targets = $arr;

        return $this;
    }

    /**
     * Whether this action is disabled (i.e. should not be run).
     *
     * Generated from protobuf field <code>bool disabled = 2;</code>
     * @return bool
     */
    public function getDisabled()
    {
        return $this->disabled;
    }

    /**
     * Whether this action is disabled (i.e. should not be run).
     *
     * Generated from protobuf field <code>bool disabled = 2;</code>
     * @param bool $var
     * @return $this
     */
    public function setDisabled($var)
    {
        GPBUtil::checkBool($var);
        $this->disabled = $var;

        return $this;
    }

    /**
     * Arbitrary, user-defined tags on this action.
     *
     * Generated from protobuf field <code>repeated string tags = 4;</code>
     * @return RepeatedField<string>
     */
    public function getTags()
    {
        return $this->tags;
    }

    /**
     * Arbitrary, user-defined tags on this action.
     *
     * Generated from protobuf field <code>repeated string tags = 4;</code>
     * @param string[] $var
     * @return $this
     */
    public function setTags($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->tags = $arr;

        return $this;
    }

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

}

