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

namespace Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\Property;

use UnexpectedValueException;

/**
 * Types of occurrences of the entity type in the document.  Note: this
 * represents the number of instances of an entity types, not number of
 * mentions of a given entity instance.
 *
 * Protobuf type <code>google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType</code>
 */
class OccurrenceType
{
    /**
     * Unspecified occurrence type.
     *
     * Generated from protobuf enum <code>OCCURRENCE_TYPE_UNSPECIFIED = 0;</code>
     */
    const OCCURRENCE_TYPE_UNSPECIFIED = 0;
    /**
     * There will be zero or one instance of this entity type.
     *
     * Generated from protobuf enum <code>OPTIONAL_ONCE = 1;</code>
     */
    const OPTIONAL_ONCE = 1;
    /**
     * The entity type will appear zero or multiple times.
     *
     * Generated from protobuf enum <code>OPTIONAL_MULTIPLE = 2;</code>
     */
    const OPTIONAL_MULTIPLE = 2;
    /**
     * The entity type will only appear exactly once.
     *
     * Generated from protobuf enum <code>REQUIRED_ONCE = 3;</code>
     */
    const REQUIRED_ONCE = 3;
    /**
     * The entity type will appear once or more times.
     *
     * Generated from protobuf enum <code>REQUIRED_MULTIPLE = 4;</code>
     */
    const REQUIRED_MULTIPLE = 4;

    private static $valueToName = [
        self::OCCURRENCE_TYPE_UNSPECIFIED => 'OCCURRENCE_TYPE_UNSPECIFIED',
        self::OPTIONAL_ONCE => 'OPTIONAL_ONCE',
        self::OPTIONAL_MULTIPLE => 'OPTIONAL_MULTIPLE',
        self::REQUIRED_ONCE => 'REQUIRED_ONCE',
        self::REQUIRED_MULTIPLE => 'REQUIRED_MULTIPLE',
    ];

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


