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

namespace Google\Cloud\BigQuery\Storage\V1\ArrowSerializationOptions;

use UnexpectedValueException;

/**
 * The precision of the timestamp value in the Avro message. This precision
 * will **only** be applied to the column(s) with the `TIMESTAMP_PICOS` type.
 *
 * Protobuf type <code>google.cloud.bigquery.storage.v1.ArrowSerializationOptions.PicosTimestampPrecision</code>
 */
class PicosTimestampPrecision
{
    /**
     * Unspecified timestamp precision. The default precision is microseconds.
     *
     * Generated from protobuf enum <code>PICOS_TIMESTAMP_PRECISION_UNSPECIFIED = 0;</code>
     */
    const PICOS_TIMESTAMP_PRECISION_UNSPECIFIED = 0;
    /**
     * Timestamp values returned by Read API will be truncated to microsecond
     * level precision. The value will be encoded as Arrow TIMESTAMP type in a
     * 64 bit integer.
     *
     * Generated from protobuf enum <code>TIMESTAMP_PRECISION_MICROS = 1;</code>
     */
    const TIMESTAMP_PRECISION_MICROS = 1;
    /**
     * Timestamp values returned by Read API will be truncated to nanosecond
     * level precision. The value will be encoded as Arrow TIMESTAMP type in a
     * 64 bit integer.
     *
     * Generated from protobuf enum <code>TIMESTAMP_PRECISION_NANOS = 2;</code>
     */
    const TIMESTAMP_PRECISION_NANOS = 2;
    /**
     * Read API will return full precision picosecond value. The value will be
     * encoded as a string which conforms to ISO 8601 format.
     *
     * Generated from protobuf enum <code>TIMESTAMP_PRECISION_PICOS = 3;</code>
     */
    const TIMESTAMP_PRECISION_PICOS = 3;

    private static $valueToName = [
        self::PICOS_TIMESTAMP_PRECISION_UNSPECIFIED => 'PICOS_TIMESTAMP_PRECISION_UNSPECIFIED',
        self::TIMESTAMP_PRECISION_MICROS => 'TIMESTAMP_PRECISION_MICROS',
        self::TIMESTAMP_PRECISION_NANOS => 'TIMESTAMP_PRECISION_NANOS',
        self::TIMESTAMP_PRECISION_PICOS => 'TIMESTAMP_PRECISION_PICOS',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

