<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/dialogflow/v2/participant.proto

namespace Google\Cloud\Dialogflow\V2\Participant;

use UnexpectedValueException;

/**
 * Enumeration of the roles a participant can play in a conversation.
 *
 * Protobuf type <code>google.cloud.dialogflow.v2.Participant.Role</code>
 */
class Role
{
    /**
     * Participant role not set.
     *
     * Generated from protobuf enum <code>ROLE_UNSPECIFIED = 0;</code>
     */
    const ROLE_UNSPECIFIED = 0;
    /**
     * Participant is a human agent.
     *
     * Generated from protobuf enum <code>HUMAN_AGENT = 1;</code>
     */
    const HUMAN_AGENT = 1;
    /**
     * Participant is an automated agent, such as a Dialogflow agent.
     *
     * Generated from protobuf enum <code>AUTOMATED_AGENT = 2;</code>
     */
    const AUTOMATED_AGENT = 2;
    /**
     * Participant is an end user that has called or chatted with
     * Dialogflow services.
     *
     * Generated from protobuf enum <code>END_USER = 3;</code>
     */
    const END_USER = 3;

    private static $valueToName = [
        self::ROLE_UNSPECIFIED => 'ROLE_UNSPECIFIED',
        self::HUMAN_AGENT => 'HUMAN_AGENT',
        self::AUTOMATED_AGENT => 'AUTOMATED_AGENT',
        self::END_USER => 'END_USER',
    ];

    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(Role::class, \Google\Cloud\Dialogflow\V2\Participant_Role::class);

