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

namespace Google\Cloud\Dataform\V1beta1;

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

/**
 * Represents the result of compiling a Dataform project.
 *
 * Generated from protobuf message <code>google.cloud.dataform.v1beta1.CompilationResult</code>
 */
class CompilationResult extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The compilation result's name.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $name = '';
    /**
     * Immutable. If set, fields of `code_compilation_config` override the default
     * compilation settings that are specified in dataform.json.
     *
     * Generated from protobuf field <code>.google.cloud.dataform.v1beta1.CodeCompilationConfig code_compilation_config = 4 [(.google.api.field_behavior) = IMMUTABLE];</code>
     */
    private $code_compilation_config = null;
    /**
     * Output only. The fully resolved Git commit SHA of the code that was
     * compiled. Not set for compilation results whose source is a workspace.
     *
     * Generated from protobuf field <code>string resolved_git_commit_sha = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $resolved_git_commit_sha = '';
    /**
     * Output only. The version of `&#64;dataform/core` that was used for compilation.
     *
     * Generated from protobuf field <code>string dataform_core_version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $dataform_core_version = '';
    /**
     * Output only. Errors encountered during project compilation.
     *
     * Generated from protobuf field <code>repeated .google.cloud.dataform.v1beta1.CompilationResult.CompilationError compilation_errors = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $compilation_errors;
    protected $source;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Output only. The compilation result's name.
     *     @type string $git_commitish
     *           Immutable. Git commit/tag/branch name at which the repository should be
     *           compiled. Must exist in the remote repository. Examples:
     *           - a commit SHA: `12ade345`
     *           - a tag: `tag1`
     *           - a branch name: `branch1`
     *     @type string $workspace
     *           Immutable. The name of the workspace to compile. Must be in the format
     *           `projects/&#42;&#47;locations/&#42;&#47;repositories/&#42;&#47;workspaces/&#42;`.
     *     @type string $release_config
     *           Immutable. The name of the release config to compile. The release
     *           config's 'current_compilation_result' field will be updated to this
     *           compilation result. Must be in the format
     *           `projects/&#42;&#47;locations/&#42;&#47;repositories/&#42;&#47;releaseConfigs/&#42;`.
     *     @type \Google\Cloud\Dataform\V1beta1\CodeCompilationConfig $code_compilation_config
     *           Immutable. If set, fields of `code_compilation_config` override the default
     *           compilation settings that are specified in dataform.json.
     *     @type string $resolved_git_commit_sha
     *           Output only. The fully resolved Git commit SHA of the code that was
     *           compiled. Not set for compilation results whose source is a workspace.
     *     @type string $dataform_core_version
     *           Output only. The version of `&#64;dataform/core` that was used for compilation.
     *     @type array<\Google\Cloud\Dataform\V1beta1\CompilationResult\CompilationError>|\Google\Protobuf\Internal\RepeatedField $compilation_errors
     *           Output only. Errors encountered during project compilation.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dataform\V1Beta1\Dataform::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The compilation result's name.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. The compilation result's name.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Immutable. Git commit/tag/branch name at which the repository should be
     * compiled. Must exist in the remote repository. Examples:
     * - a commit SHA: `12ade345`
     * - a tag: `tag1`
     * - a branch name: `branch1`
     *
     * Generated from protobuf field <code>string git_commitish = 2 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @return string
     */
    public function getGitCommitish()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Immutable. Git commit/tag/branch name at which the repository should be
     * compiled. Must exist in the remote repository. Examples:
     * - a commit SHA: `12ade345`
     * - a tag: `tag1`
     * - a branch name: `branch1`
     *
     * Generated from protobuf field <code>string git_commitish = 2 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @param string $var
     * @return $this
     */
    public function setGitCommitish($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Immutable. The name of the workspace to compile. Must be in the format
     * `projects/&#42;&#47;locations/&#42;&#47;repositories/&#42;&#47;workspaces/&#42;`.
     *
     * Generated from protobuf field <code>string workspace = 3 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getWorkspace()
    {
        return $this->readOneof(3);
    }

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

    /**
     * Immutable. The name of the workspace to compile. Must be in the format
     * `projects/&#42;&#47;locations/&#42;&#47;repositories/&#42;&#47;workspaces/&#42;`.
     *
     * Generated from protobuf field <code>string workspace = 3 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setWorkspace($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Immutable. The name of the release config to compile. The release
     * config's 'current_compilation_result' field will be updated to this
     * compilation result. Must be in the format
     * `projects/&#42;&#47;locations/&#42;&#47;repositories/&#42;&#47;releaseConfigs/&#42;`.
     *
     * Generated from protobuf field <code>string release_config = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getReleaseConfig()
    {
        return $this->readOneof(7);
    }

    public function hasReleaseConfig()
    {
        return $this->hasOneof(7);
    }

    /**
     * Immutable. The name of the release config to compile. The release
     * config's 'current_compilation_result' field will be updated to this
     * compilation result. Must be in the format
     * `projects/&#42;&#47;locations/&#42;&#47;repositories/&#42;&#47;releaseConfigs/&#42;`.
     *
     * Generated from protobuf field <code>string release_config = 7 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setReleaseConfig($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(7, $var);

        return $this;
    }

    /**
     * Immutable. If set, fields of `code_compilation_config` override the default
     * compilation settings that are specified in dataform.json.
     *
     * Generated from protobuf field <code>.google.cloud.dataform.v1beta1.CodeCompilationConfig code_compilation_config = 4 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @return \Google\Cloud\Dataform\V1beta1\CodeCompilationConfig|null
     */
    public function getCodeCompilationConfig()
    {
        return $this->code_compilation_config;
    }

    public function hasCodeCompilationConfig()
    {
        return isset($this->code_compilation_config);
    }

    public function clearCodeCompilationConfig()
    {
        unset($this->code_compilation_config);
    }

    /**
     * Immutable. If set, fields of `code_compilation_config` override the default
     * compilation settings that are specified in dataform.json.
     *
     * Generated from protobuf field <code>.google.cloud.dataform.v1beta1.CodeCompilationConfig code_compilation_config = 4 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @param \Google\Cloud\Dataform\V1beta1\CodeCompilationConfig $var
     * @return $this
     */
    public function setCodeCompilationConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataform\V1beta1\CodeCompilationConfig::class);
        $this->code_compilation_config = $var;

        return $this;
    }

    /**
     * Output only. The fully resolved Git commit SHA of the code that was
     * compiled. Not set for compilation results whose source is a workspace.
     *
     * Generated from protobuf field <code>string resolved_git_commit_sha = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getResolvedGitCommitSha()
    {
        return $this->resolved_git_commit_sha;
    }

    /**
     * Output only. The fully resolved Git commit SHA of the code that was
     * compiled. Not set for compilation results whose source is a workspace.
     *
     * Generated from protobuf field <code>string resolved_git_commit_sha = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setResolvedGitCommitSha($var)
    {
        GPBUtil::checkString($var, True);
        $this->resolved_git_commit_sha = $var;

        return $this;
    }

    /**
     * Output only. The version of `&#64;dataform/core` that was used for compilation.
     *
     * Generated from protobuf field <code>string dataform_core_version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getDataformCoreVersion()
    {
        return $this->dataform_core_version;
    }

    /**
     * Output only. The version of `&#64;dataform/core` that was used for compilation.
     *
     * Generated from protobuf field <code>string dataform_core_version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setDataformCoreVersion($var)
    {
        GPBUtil::checkString($var, True);
        $this->dataform_core_version = $var;

        return $this;
    }

    /**
     * Output only. Errors encountered during project compilation.
     *
     * Generated from protobuf field <code>repeated .google.cloud.dataform.v1beta1.CompilationResult.CompilationError compilation_errors = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getCompilationErrors()
    {
        return $this->compilation_errors;
    }

    /**
     * Output only. Errors encountered during project compilation.
     *
     * Generated from protobuf field <code>repeated .google.cloud.dataform.v1beta1.CompilationResult.CompilationError compilation_errors = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param array<\Google\Cloud\Dataform\V1beta1\CompilationResult\CompilationError>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setCompilationErrors($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dataform\V1beta1\CompilationResult\CompilationError::class);
        $this->compilation_errors = $arr;

        return $this;
    }

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

}

