<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: livekit_connector_whatsapp.proto

namespace Livekit\DisconnectWhatsAppCallRequest;

use UnexpectedValueException;

/**
 * Protobuf type <code>livekit.DisconnectWhatsAppCallRequest.DisconnectReason</code>
 */
class DisconnectReason
{
    /**
     * The call is being disconnected by the business
     *
     * Generated from protobuf enum <code>BUSINESS_INITIATED = 0;</code>
     */
    const BUSINESS_INITIATED = 0;
    /**
     * The call is disconnected by the user.
     * This can be tracked as part of call terminate webhook
     * https://developers.facebook.com/documentation/business-messaging/whatsapp/calling/user-initiated-calls#call-terminate-webhook
     * Note that this webhook will also be sent when the call is disconnected by the business.
     * Calling the API twice in such cases will result in an error.
     *
     * Generated from protobuf enum <code>USER_INITIATED = 1;</code>
     */
    const USER_INITIATED = 1;

    private static $valueToName = [
        self::BUSINESS_INITIATED => 'BUSINESS_INITIATED',
        self::USER_INITIATED => 'USER_INITIATED',
    ];

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

