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

namespace Google\Cloud\DocumentAI\V1\Document\Entity;

use UnexpectedValueException;

/**
 * Specifies how the entity's value is obtained.
 *
 * Protobuf type <code>google.cloud.documentai.v1.Document.Entity.Method</code>
 */
class Method
{
    /**
     * When the method is not specified, it should be treated as `EXTRACT`.
     *
     * Generated from protobuf enum <code>METHOD_UNSPECIFIED = 0;</code>
     */
    const METHOD_UNSPECIFIED = 0;
    /**
     * The entity's value is directly extracted as-is from the document
     * text.
     *
     * Generated from protobuf enum <code>EXTRACT = 1;</code>
     */
    const EXTRACT = 1;
    /**
     * The entity's value is derived through inference and is not
     * necessarily an exact text extraction from the document.
     *
     * Generated from protobuf enum <code>DERIVE = 2;</code>
     */
    const DERIVE = 2;

    private static $valueToName = [
        self::METHOD_UNSPECIFIED => 'METHOD_UNSPECIFIED',
        self::EXTRACT => 'EXTRACT',
        self::DERIVE => 'DERIVE',
    ];

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


