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

namespace Google\Cloud\DataLabeling\V1beta1;

use UnexpectedValueException;

/**
 * Protobuf type <code>google.cloud.datalabeling.v1beta1.StringAggregationType</code>
 */
class StringAggregationType
{
    /**
     * Generated from protobuf enum <code>STRING_AGGREGATION_TYPE_UNSPECIFIED = 0;</code>
     */
    const STRING_AGGREGATION_TYPE_UNSPECIFIED = 0;
    /**
     * Majority vote to aggregate answers.
     *
     * Generated from protobuf enum <code>MAJORITY_VOTE = 1;</code>
     */
    const MAJORITY_VOTE = 1;
    /**
     * Unanimous answers will be adopted.
     *
     * Generated from protobuf enum <code>UNANIMOUS_VOTE = 2;</code>
     */
    const UNANIMOUS_VOTE = 2;
    /**
     * Preserve all answers by crowd compute.
     *
     * Generated from protobuf enum <code>NO_AGGREGATION = 3;</code>
     */
    const NO_AGGREGATION = 3;

    private static $valueToName = [
        self::STRING_AGGREGATION_TYPE_UNSPECIFIED => 'STRING_AGGREGATION_TYPE_UNSPECIFIED',
        self::MAJORITY_VOTE => 'MAJORITY_VOTE',
        self::UNANIMOUS_VOTE => 'UNANIMOUS_VOTE',
        self::NO_AGGREGATION => 'NO_AGGREGATION',
    ];

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

