<?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.  This
 * represents the number of instances of instances of an entity, not
 * number of mentions of an entity.  For example, a bank statement may
 * only have one `account_number`, but this account number may be
 * mentioned in several places on the document.  In this case the
 * 'account_number' would be considered a `REQUIRED_ONCE` entity type. If,
 * on the other hand, we expect a bank statement to contain the status of
 * multiple different accounts for the customers, the occurrence type will
 * be set to `REQUIRED_MULTIPLE`.
 *
 * 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.  The same
     * entity instance may be mentioned multiple times.
     *
     * 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.  The same
     * entity instance may be mentioned multiple times.
     *
     * 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);
    }
}


