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

namespace PhpWA\Protocol\Proto\CallLogRecord;

use UnexpectedValueException;

/**
 * Protobuf type <code>proto.CallLogRecord.CallResult</code>
 */
class CallResult
{
    /**
     * Generated from protobuf enum <code>CONNECTED = 0;</code>
     */
    const CONNECTED = 0;
    /**
     * Generated from protobuf enum <code>REJECTED = 1;</code>
     */
    const REJECTED = 1;
    /**
     * Generated from protobuf enum <code>CANCELLED = 2;</code>
     */
    const CANCELLED = 2;
    /**
     * Generated from protobuf enum <code>ACCEPTEDELSEWHERE = 3;</code>
     */
    const ACCEPTEDELSEWHERE = 3;
    /**
     * Generated from protobuf enum <code>MISSED = 4;</code>
     */
    const MISSED = 4;
    /**
     * Generated from protobuf enum <code>INVALID = 5;</code>
     */
    const INVALID = 5;
    /**
     * Generated from protobuf enum <code>UNAVAILABLE = 6;</code>
     */
    const UNAVAILABLE = 6;
    /**
     * Generated from protobuf enum <code>UPCOMING = 7;</code>
     */
    const UPCOMING = 7;
    /**
     * Generated from protobuf enum <code>FAILED = 8;</code>
     */
    const FAILED = 8;
    /**
     * Generated from protobuf enum <code>ABANDONED = 9;</code>
     */
    const ABANDONED = 9;
    /**
     * Generated from protobuf enum <code>ONGOING = 10;</code>
     */
    const ONGOING = 10;

    private static $valueToName = [
        self::CONNECTED => 'CONNECTED',
        self::REJECTED => 'REJECTED',
        self::CANCELLED => 'CANCELLED',
        self::ACCEPTEDELSEWHERE => 'ACCEPTEDELSEWHERE',
        self::MISSED => 'MISSED',
        self::INVALID => 'INVALID',
        self::UNAVAILABLE => 'UNAVAILABLE',
        self::UPCOMING => 'UPCOMING',
        self::FAILED => 'FAILED',
        self::ABANDONED => 'ABANDONED',
        self::ONGOING => 'ONGOING',
    ];

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

