<?php
 
 
 

namespace PhpWA\Protocol\Proto\Message\PeerDataOperationRequestResponseMessage\PeerDataOperationResult;

use UnexpectedValueException;




class FullHistorySyncOnDemandResponseCode
{
    


    const REQUEST_SUCCESS = 0;
    


    const REQUEST_TIME_EXPIRED = 1;
    


    const DECLINED_SHARING_HISTORY = 2;
    


    const GENERIC_ERROR = 3;
    


    const ERROR_REQUEST_ON_NON_SMB_PRIMARY = 4;
    


    const ERROR_HOSTED_DEVICE_NOT_CONNECTED = 5;
    


    const ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET = 6;

    private static $valueToName = [
        self::REQUEST_SUCCESS => 'REQUEST_SUCCESS',
        self::REQUEST_TIME_EXPIRED => 'REQUEST_TIME_EXPIRED',
        self::DECLINED_SHARING_HISTORY => 'DECLINED_SHARING_HISTORY',
        self::GENERIC_ERROR => 'GENERIC_ERROR',
        self::ERROR_REQUEST_ON_NON_SMB_PRIMARY => 'ERROR_REQUEST_ON_NON_SMB_PRIMARY',
        self::ERROR_HOSTED_DEVICE_NOT_CONNECTED => 'ERROR_HOSTED_DEVICE_NOT_CONNECTED',
        self::ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET => 'ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET',
    ];

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

