<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/merchant/products/v1/products_common.proto

namespace Google\Shopping\Merchant\Products\V1\ProductAttributes\FuelConsumption;

use UnexpectedValueException;

/**
 * The unit of the fuel consumption.
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.ProductAttributes.FuelConsumption.Unit</code>
 */
class Unit
{
    /**
     * Unspecified unit.
     *
     * Generated from protobuf enum <code>UNIT_UNSPECIFIED = 0;</code>
     */
    const UNIT_UNSPECIFIED = 0;
    /**
     * Liter per 100 kilometers.
     *
     * Generated from protobuf enum <code>LPER100KM = 1;</code>
     */
    const LPER100KM = 1;
    /**
     * Kilograms per 100 kilometers.
     *
     * Generated from protobuf enum <code>KGPER100KM = 2;</code>
     */
    const KGPER100KM = 2;

    private static $valueToName = [
        self::UNIT_UNSPECIFIED => 'UNIT_UNSPECIFIED',
        self::LPER100KM => 'LPER100KM',
        self::KGPER100KM => 'KGPER100KM',
    ];

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

