<?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 UnexpectedValueException;

/**
 * Encoding of input data in CSV/JSON format.
 *
 * Protobuf type <code>google.cloud.bigquery.datatransfer.v1.ImportedDataInfo.Encoding</code>
 */
class Encoding
{
    /**
     * Default encoding (UTF8).
     *
     * Generated from protobuf enum <code>ENCODING_UNSPECIFIED = 0;</code>
     */
    const ENCODING_UNSPECIFIED = 0;
    /**
     * ISO_8859_1 encoding.
     *
     * Generated from protobuf enum <code>ISO_8859_1 = 1;</code>
     */
    const ISO_8859_1 = 1;
    /**
     * UTF8 encoding.
     *
     * Generated from protobuf enum <code>UTF8 = 2;</code>
     */
    const UTF8 = 2;

    private static $valueToName = [
        self::ENCODING_UNSPECIFIED => 'ENCODING_UNSPECIFIED',
        self::ISO_8859_1 => 'ISO_8859_1',
        self::UTF8 => 'UTF8',
    ];

    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);
    }
}

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

