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

namespace Google\Cloud\AutoMl\V1beta1;

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

/**
 * Indicated the type of data that can be stored in a structured data entity
 * (e.g. a table).
 *
 * Generated from protobuf message <code>google.cloud.automl.v1beta1.DataType</code>
 */
class DataType extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The [TypeCode][google.cloud.automl.v1beta1.TypeCode] for this type.
     *
     * Generated from protobuf field <code>.google.cloud.automl.v1beta1.TypeCode type_code = 1;</code>
     */
    private $type_code = 0;
    /**
     * If true, this DataType can also be `NULL`. In .CSV files `NULL` value is
     * expressed as an empty string.
     *
     * Generated from protobuf field <code>bool nullable = 4;</code>
     */
    private $nullable = false;
    protected $details;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\AutoMl\V1beta1\DataType $list_element_type
     *           If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [ARRAY][google.cloud.automl.v1beta1.TypeCode.ARRAY],
     *           then `list_element_type` is the type of the elements.
     *     @type \Google\Cloud\AutoMl\V1beta1\StructType $struct_type
     *           If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [STRUCT][google.cloud.automl.v1beta1.TypeCode.STRUCT], then `struct_type`
     *           provides type information for the struct's fields.
     *     @type string $time_format
     *           If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [TIMESTAMP][google.cloud.automl.v1beta1.TypeCode.TIMESTAMP]
     *           then `time_format` provides the format in which that time field is
     *           expressed. The time_format must either be one of:
     *           * `UNIX_SECONDS`
     *           * `UNIX_MILLISECONDS`
     *           * `UNIX_MICROSECONDS`
     *           * `UNIX_NANOSECONDS`
     *           (for respectively number of seconds, milliseconds, microseconds and
     *           nanoseconds since start of the Unix epoch);
     *           or be written in `strftime` syntax. If time_format is not set, then the
     *           default format as described on the type_code is used.
     *     @type int $type_code
     *           Required. The [TypeCode][google.cloud.automl.v1beta1.TypeCode] for this type.
     *     @type bool $nullable
     *           If true, this DataType can also be `NULL`. In .CSV files `NULL` value is
     *           expressed as an empty string.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Automl\V1Beta1\DataTypes::initOnce();
        parent::__construct($data);
    }

    /**
     * If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [ARRAY][google.cloud.automl.v1beta1.TypeCode.ARRAY],
     * then `list_element_type` is the type of the elements.
     *
     * Generated from protobuf field <code>.google.cloud.automl.v1beta1.DataType list_element_type = 2;</code>
     * @return \Google\Cloud\AutoMl\V1beta1\DataType
     */
    public function getListElementType()
    {
        return $this->readOneof(2);
    }

    /**
     * If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [ARRAY][google.cloud.automl.v1beta1.TypeCode.ARRAY],
     * then `list_element_type` is the type of the elements.
     *
     * Generated from protobuf field <code>.google.cloud.automl.v1beta1.DataType list_element_type = 2;</code>
     * @param \Google\Cloud\AutoMl\V1beta1\DataType $var
     * @return $this
     */
    public function setListElementType($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\DataType::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [STRUCT][google.cloud.automl.v1beta1.TypeCode.STRUCT], then `struct_type`
     * provides type information for the struct's fields.
     *
     * Generated from protobuf field <code>.google.cloud.automl.v1beta1.StructType struct_type = 3;</code>
     * @return \Google\Cloud\AutoMl\V1beta1\StructType
     */
    public function getStructType()
    {
        return $this->readOneof(3);
    }

    /**
     * If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [STRUCT][google.cloud.automl.v1beta1.TypeCode.STRUCT], then `struct_type`
     * provides type information for the struct's fields.
     *
     * Generated from protobuf field <code>.google.cloud.automl.v1beta1.StructType struct_type = 3;</code>
     * @param \Google\Cloud\AutoMl\V1beta1\StructType $var
     * @return $this
     */
    public function setStructType($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AutoMl\V1beta1\StructType::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [TIMESTAMP][google.cloud.automl.v1beta1.TypeCode.TIMESTAMP]
     * then `time_format` provides the format in which that time field is
     * expressed. The time_format must either be one of:
     * * `UNIX_SECONDS`
     * * `UNIX_MILLISECONDS`
     * * `UNIX_MICROSECONDS`
     * * `UNIX_NANOSECONDS`
     * (for respectively number of seconds, milliseconds, microseconds and
     * nanoseconds since start of the Unix epoch);
     * or be written in `strftime` syntax. If time_format is not set, then the
     * default format as described on the type_code is used.
     *
     * Generated from protobuf field <code>string time_format = 5;</code>
     * @return string
     */
    public function getTimeFormat()
    {
        return $this->readOneof(5);
    }

    /**
     * If [type_code][google.cloud.automl.v1beta1.DataType.type_code] == [TIMESTAMP][google.cloud.automl.v1beta1.TypeCode.TIMESTAMP]
     * then `time_format` provides the format in which that time field is
     * expressed. The time_format must either be one of:
     * * `UNIX_SECONDS`
     * * `UNIX_MILLISECONDS`
     * * `UNIX_MICROSECONDS`
     * * `UNIX_NANOSECONDS`
     * (for respectively number of seconds, milliseconds, microseconds and
     * nanoseconds since start of the Unix epoch);
     * or be written in `strftime` syntax. If time_format is not set, then the
     * default format as described on the type_code is used.
     *
     * Generated from protobuf field <code>string time_format = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setTimeFormat($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Required. The [TypeCode][google.cloud.automl.v1beta1.TypeCode] for this type.
     *
     * Generated from protobuf field <code>.google.cloud.automl.v1beta1.TypeCode type_code = 1;</code>
     * @return int
     */
    public function getTypeCode()
    {
        return $this->type_code;
    }

    /**
     * Required. The [TypeCode][google.cloud.automl.v1beta1.TypeCode] for this type.
     *
     * Generated from protobuf field <code>.google.cloud.automl.v1beta1.TypeCode type_code = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setTypeCode($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\AutoMl\V1beta1\TypeCode::class);
        $this->type_code = $var;

        return $this;
    }

    /**
     * If true, this DataType can also be `NULL`. In .CSV files `NULL` value is
     * expressed as an empty string.
     *
     * Generated from protobuf field <code>bool nullable = 4;</code>
     * @return bool
     */
    public function getNullable()
    {
        return $this->nullable;
    }

    /**
     * If true, this DataType can also be `NULL`. In .CSV files `NULL` value is
     * expressed as an empty string.
     *
     * Generated from protobuf field <code>bool nullable = 4;</code>
     * @param bool $var
     * @return $this
     */
    public function setNullable($var)
    {
        GPBUtil::checkBool($var);
        $this->nullable = $var;

        return $this;
    }

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

}

