<?php
 
 
 

namespace PhpWA\Protocol\Proto\Message;

use UnexpectedValueException;




class HistorySyncType
{
    


    const INITIAL_BOOTSTRAP = 0;
    


    const INITIAL_STATUS_V3 = 1;
    


    const FULL = 2;
    


    const RECENT = 3;
    


    const PUSH_NAME = 4;
    


    const NON_BLOCKING_DATA = 5;
    


    const ON_DEMAND = 6;
    


    const NO_HISTORY = 7;
    


    const MESSAGE_ACCESS_STATUS = 8;

    private static $valueToName = [
        self::INITIAL_BOOTSTRAP => 'INITIAL_BOOTSTRAP',
        self::INITIAL_STATUS_V3 => 'INITIAL_STATUS_V3',
        self::FULL => 'FULL',
        self::RECENT => 'RECENT',
        self::PUSH_NAME => 'PUSH_NAME',
        self::NON_BLOCKING_DATA => 'NON_BLOCKING_DATA',
        self::ON_DEMAND => 'ON_DEMAND',
        self::NO_HISTORY => 'NO_HISTORY',
        self::MESSAGE_ACCESS_STATUS => 'MESSAGE_ACCESS_STATUS',
    ];

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

