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

namespace Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo;

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

/**
 * External table definition. These tables can be referenced with 'name'
 * in the query and can be read just like any other table.
 *
 * Generated from protobuf message <code>google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.TableDefinition</code>
 */
class TableDefinition extends \Google\Protobuf\Internal\Message
{
    /**
     * BigQuery table_id (required). This will be used to reference this
     * table in the query.
     *
     * Generated from protobuf field <code>string table_id = 1;</code>
     */
    private $table_id = '';
    /**
     * URIs for the data to be imported. All URIs must be from the same storage
     * system.
     *
     * Generated from protobuf field <code>repeated string source_uris = 2;</code>
     */
    private $source_uris;
    /**
     * Describes the format of the data in source_uri.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.Format format = 3;</code>
     */
    private $format = 0;
    /**
     * Specify the maximum number of bad records that can be ignored.
     * If bad records exceed this threshold the query is aborted.
     *
     * Generated from protobuf field <code>int32 max_bad_records = 4;</code>
     */
    private $max_bad_records = 0;
    /**
     * Character encoding of the input when applicable (CSV, JSON).
     * Defaults to UTF8.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.Encoding encoding = 5;</code>
     */
    private $encoding = 0;
    /**
     * CSV specific options.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.TableDefinition.CsvOptions csv_options = 6;</code>
     */
    private $csv_options = null;
    /**
     * Optional schema for the data. When not specified for JSON and CSV formats
     * we will try to detect it automatically.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.RecordSchema schema = 7;</code>
     */
    private $schema = null;
    /**
     * Indicates if extra values that are not represented in the table schema is
     * allowed.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue ignore_unknown_values = 10;</code>
     */
    private $ignore_unknown_values = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $table_id
     *           BigQuery table_id (required). This will be used to reference this
     *           table in the query.
     *     @type string[]|\Google\Protobuf\Internal\RepeatedField $source_uris
     *           URIs for the data to be imported. All URIs must be from the same storage
     *           system.
     *     @type int $format
     *           Describes the format of the data in source_uri.
     *     @type int $max_bad_records
     *           Specify the maximum number of bad records that can be ignored.
     *           If bad records exceed this threshold the query is aborted.
     *     @type int $encoding
     *           Character encoding of the input when applicable (CSV, JSON).
     *           Defaults to UTF8.
     *     @type \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo\TableDefinition\CsvOptions $csv_options
     *           CSV specific options.
     *     @type \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo\RecordSchema $schema
     *           Optional schema for the data. When not specified for JSON and CSV formats
     *           we will try to detect it automatically.
     *     @type \Google\Protobuf\BoolValue $ignore_unknown_values
     *           Indicates if extra values that are not represented in the table schema is
     *           allowed.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datasource::initOnce();
        parent::__construct($data);
    }

    /**
     * BigQuery table_id (required). This will be used to reference this
     * table in the query.
     *
     * Generated from protobuf field <code>string table_id = 1;</code>
     * @return string
     */
    public function getTableId()
    {
        return $this->table_id;
    }

    /**
     * BigQuery table_id (required). This will be used to reference this
     * table in the query.
     *
     * Generated from protobuf field <code>string table_id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setTableId($var)
    {
        GPBUtil::checkString($var, True);
        $this->table_id = $var;

        return $this;
    }

    /**
     * URIs for the data to be imported. All URIs must be from the same storage
     * system.
     *
     * Generated from protobuf field <code>repeated string source_uris = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getSourceUris()
    {
        return $this->source_uris;
    }

    /**
     * URIs for the data to be imported. All URIs must be from the same storage
     * system.
     *
     * Generated from protobuf field <code>repeated string source_uris = 2;</code>
     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setSourceUris($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->source_uris = $arr;

        return $this;
    }

    /**
     * Describes the format of the data in source_uri.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.Format format = 3;</code>
     * @return int
     */
    public function getFormat()
    {
        return $this->format;
    }

    /**
     * Describes the format of the data in source_uri.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.Format format = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setFormat($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo_Format::class);
        $this->format = $var;

        return $this;
    }

    /**
     * Specify the maximum number of bad records that can be ignored.
     * If bad records exceed this threshold the query is aborted.
     *
     * Generated from protobuf field <code>int32 max_bad_records = 4;</code>
     * @return int
     */
    public function getMaxBadRecords()
    {
        return $this->max_bad_records;
    }

    /**
     * Specify the maximum number of bad records that can be ignored.
     * If bad records exceed this threshold the query is aborted.
     *
     * Generated from protobuf field <code>int32 max_bad_records = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setMaxBadRecords($var)
    {
        GPBUtil::checkInt32($var);
        $this->max_bad_records = $var;

        return $this;
    }

    /**
     * Character encoding of the input when applicable (CSV, JSON).
     * Defaults to UTF8.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.Encoding encoding = 5;</code>
     * @return int
     */
    public function getEncoding()
    {
        return $this->encoding;
    }

    /**
     * Character encoding of the input when applicable (CSV, JSON).
     * Defaults to UTF8.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.Encoding encoding = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setEncoding($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo_Encoding::class);
        $this->encoding = $var;

        return $this;
    }

    /**
     * CSV specific options.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.TableDefinition.CsvOptions csv_options = 6;</code>
     * @return \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo\TableDefinition\CsvOptions
     */
    public function getCsvOptions()
    {
        return $this->csv_options;
    }

    /**
     * CSV specific options.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.TableDefinition.CsvOptions csv_options = 6;</code>
     * @param \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo\TableDefinition\CsvOptions $var
     * @return $this
     */
    public function setCsvOptions($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo_TableDefinition_CsvOptions::class);
        $this->csv_options = $var;

        return $this;
    }

    /**
     * Optional schema for the data. When not specified for JSON and CSV formats
     * we will try to detect it automatically.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.RecordSchema schema = 7;</code>
     * @return \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo\RecordSchema
     */
    public function getSchema()
    {
        return $this->schema;
    }

    /**
     * Optional schema for the data. When not specified for JSON and CSV formats
     * we will try to detect it automatically.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.RecordSchema schema = 7;</code>
     * @param \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo\RecordSchema $var
     * @return $this
     */
    public function setSchema($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo_RecordSchema::class);
        $this->schema = $var;

        return $this;
    }

    /**
     * Indicates if extra values that are not represented in the table schema is
     * allowed.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue ignore_unknown_values = 10;</code>
     * @return \Google\Protobuf\BoolValue
     */
    public function getIgnoreUnknownValues()
    {
        return $this->ignore_unknown_values;
    }

    /**
     * Returns the unboxed value from <code>getIgnoreUnknownValues()</code>

     * Indicates if extra values that are not represented in the table schema is
     * allowed.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue ignore_unknown_values = 10;</code>
     * @return bool|null
     */
    public function getIgnoreUnknownValuesValue()
    {
        $wrapper = $this->getIgnoreUnknownValues();
        return is_null($wrapper) ? null : $wrapper->getValue();
    }

    /**
     * Indicates if extra values that are not represented in the table schema is
     * allowed.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue ignore_unknown_values = 10;</code>
     * @param \Google\Protobuf\BoolValue $var
     * @return $this
     */
    public function setIgnoreUnknownValues($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class);
        $this->ignore_unknown_values = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object.

     * Indicates if extra values that are not represented in the table schema is
     * allowed.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue ignore_unknown_values = 10;</code>
     * @param bool|null $var
     * @return $this
     */
    public function setIgnoreUnknownValuesValue($var)
    {
        $wrappedVar = is_null($var) ? null : new \Google\Protobuf\BoolValue(['value' => $var]);
        return $this->setIgnoreUnknownValues($wrappedVar);
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(TableDefinition::class, \Google\Cloud\BigQuery\DataTransfer\V1\ImportedDataInfo_TableDefinition::class);

