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

namespace Google\Cloud\DataCatalog\V1;

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

/**
 * Specification for the BigQuery connection.
 *
 * Generated from protobuf message <code>google.cloud.datacatalog.v1.BigQueryConnectionSpec</code>
 */
class BigQueryConnectionSpec extends \Google\Protobuf\Internal\Message
{
    /**
     * The type of the BigQuery connection.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.BigQueryConnectionSpec.ConnectionType connection_type = 1;</code>
     */
    private $connection_type = 0;
    /**
     * True if there are credentials attached to the BigQuery connection; false
     * otherwise.
     *
     * Generated from protobuf field <code>bool has_credential = 3;</code>
     */
    private $has_credential = false;
    protected $connection_spec;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $connection_type
     *           The type of the BigQuery connection.
     *     @type \Google\Cloud\DataCatalog\V1\CloudSqlBigQueryConnectionSpec $cloud_sql
     *           Specification for the BigQuery connection to a Cloud SQL instance.
     *     @type bool $has_credential
     *           True if there are credentials attached to the BigQuery connection; false
     *           otherwise.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Datacatalog\V1\Bigquery::initOnce();
        parent::__construct($data);
    }

    /**
     * The type of the BigQuery connection.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.BigQueryConnectionSpec.ConnectionType connection_type = 1;</code>
     * @return int
     */
    public function getConnectionType()
    {
        return $this->connection_type;
    }

    /**
     * The type of the BigQuery connection.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.BigQueryConnectionSpec.ConnectionType connection_type = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setConnectionType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\DataCatalog\V1\BigQueryConnectionSpec\ConnectionType::class);
        $this->connection_type = $var;

        return $this;
    }

    /**
     * Specification for the BigQuery connection to a Cloud SQL instance.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.CloudSqlBigQueryConnectionSpec cloud_sql = 2;</code>
     * @return \Google\Cloud\DataCatalog\V1\CloudSqlBigQueryConnectionSpec|null
     */
    public function getCloudSql()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Specification for the BigQuery connection to a Cloud SQL instance.
     *
     * Generated from protobuf field <code>.google.cloud.datacatalog.v1.CloudSqlBigQueryConnectionSpec cloud_sql = 2;</code>
     * @param \Google\Cloud\DataCatalog\V1\CloudSqlBigQueryConnectionSpec $var
     * @return $this
     */
    public function setCloudSql($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\DataCatalog\V1\CloudSqlBigQueryConnectionSpec::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * True if there are credentials attached to the BigQuery connection; false
     * otherwise.
     *
     * Generated from protobuf field <code>bool has_credential = 3;</code>
     * @return bool
     */
    public function getHasCredential()
    {
        return $this->has_credential;
    }

    /**
     * True if there are credentials attached to the BigQuery connection; false
     * otherwise.
     *
     * Generated from protobuf field <code>bool has_credential = 3;</code>
     * @param bool $var
     * @return $this
     */
    public function setHasCredential($var)
    {
        GPBUtil::checkBool($var);
        $this->has_credential = $var;

        return $this;
    }

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

}

