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

namespace Google\Cloud\AutoMl\V1beta1\DocumentDimensions;

use UnexpectedValueException;

/**
 * Unit of the document dimension.
 *
 * Protobuf type <code>google.cloud.automl.v1beta1.DocumentDimensions.DocumentDimensionUnit</code>
 */
class DocumentDimensionUnit
{
    /**
     * Should not be used.
     *
     * Generated from protobuf enum <code>DOCUMENT_DIMENSION_UNIT_UNSPECIFIED = 0;</code>
     */
    const DOCUMENT_DIMENSION_UNIT_UNSPECIFIED = 0;
    /**
     * Document dimension is measured in inches.
     *
     * Generated from protobuf enum <code>INCH = 1;</code>
     */
    const INCH = 1;
    /**
     * Document dimension is measured in centimeters.
     *
     * Generated from protobuf enum <code>CENTIMETER = 2;</code>
     */
    const CENTIMETER = 2;
    /**
     * Document dimension is measured in points. 72 points = 1 inch.
     *
     * Generated from protobuf enum <code>POINT = 3;</code>
     */
    const POINT = 3;

    private static $valueToName = [
        self::DOCUMENT_DIMENSION_UNIT_UNSPECIFIED => 'DOCUMENT_DIMENSION_UNIT_UNSPECIFIED',
        self::INCH => 'INCH',
        self::CENTIMETER => 'CENTIMETER',
        self::POINT => 'POINT',
    ];

    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(DocumentDimensionUnit::class, \Google\Cloud\AutoMl\V1beta1\DocumentDimensions_DocumentDimensionUnit::class);

