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

namespace Google\Cloud\DataCatalog\V1;

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

/**
 * Describes a BigQuery table.
 *
 * Generated from protobuf message <code>google.cloud.datacatalog.v1.BigQueryTableSpec</code>
 */
class BigQueryTableSpec extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The table source type.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.TableSourceType table_source_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $table_source_type = 0;
    protected $type_spec;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $table_source_type
     *           Output only. The table source type.
     *     @type \Google\Cloud\DataCatalog\V1\ViewSpec $view_spec
     *           Table view specification. This field should only be populated if
     *           `table_source_type` is `BIGQUERY_VIEW`.
     *     @type \Google\Cloud\DataCatalog\V1\TableSpec $table_spec
     *           Spec of a BigQuery table. This field should only be populated if
     *           `table_source_type` is `BIGQUERY_TABLE`.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Datacatalog\V1\TableSpec::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The table source type.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.TableSourceType table_source_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getTableSourceType()
    {
        return $this->table_source_type;
    }

    /**
     * Output only. The table source type.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.TableSourceType table_source_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setTableSourceType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\DataCatalog\V1\TableSourceType::class);
        $this->table_source_type = $var;

        return $this;
    }

    /**
     * Table view specification. This field should only be populated if
     * `table_source_type` is `BIGQUERY_VIEW`.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.ViewSpec view_spec = 2;</code>
     * @return \Google\Cloud\DataCatalog\V1\ViewSpec
     */
    public function getViewSpec()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Table view specification. This field should only be populated if
     * `table_source_type` is `BIGQUERY_VIEW`.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.ViewSpec view_spec = 2;</code>
     * @param \Google\Cloud\DataCatalog\V1\ViewSpec $var
     * @return $this
     */
    public function setViewSpec($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\DataCatalog\V1\ViewSpec::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Spec of a BigQuery table. This field should only be populated if
     * `table_source_type` is `BIGQUERY_TABLE`.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.TableSpec table_spec = 3;</code>
     * @return \Google\Cloud\DataCatalog\V1\TableSpec
     */
    public function getTableSpec()
    {
        return $this->readOneof(3);
    }

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

    /**
     * Spec of a BigQuery table. This field should only be populated if
     * `table_source_type` is `BIGQUERY_TABLE`.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.TableSpec table_spec = 3;</code>
     * @param \Google\Cloud\DataCatalog\V1\TableSpec $var
     * @return $this
     */
    public function setTableSpec($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\DataCatalog\V1\TableSpec::class);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

