<?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\UnitArea;

use UnexpectedValueException;

/**
 * The unit of area.
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.ProductAttributes.UnitArea.Unit</code>
 */
class Unit
{
    /**
     * Unspecified unit.
     *
     * Generated from protobuf enum <code>UNIT_UNSPECIFIED = 0;</code>
     */
    const UNIT_UNSPECIFIED = 0;
    /**
     * Square meters.
     *
     * Generated from protobuf enum <code>SQM = 1;</code>
     */
    const SQM = 1;
    /**
     * Square feet.
     *
     * Generated from protobuf enum <code>SQFT = 2;</code>
     */
    const SQFT = 2;

    private static $valueToName = [
        self::UNIT_UNSPECIFIED => 'UNIT_UNSPECIFIED',
        self::SQM => 'SQM',
        self::SQFT => 'SQFT',
    ];

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

