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

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

use UnexpectedValueException;

/**
 * Protobuf type <code>proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.HistorySyncChunkRetryResponseCode</code>
 */
class HistorySyncChunkRetryResponseCode
{
    /**
     * Generated from protobuf enum <code>HISTORY_SYNC_CHUNK_RETRY_RESPONSE_CODE_UNSPECIFIED = 0;</code>
     */
    const HISTORY_SYNC_CHUNK_RETRY_RESPONSE_CODE_UNSPECIFIED = 0;
    /**
     * Generated from protobuf enum <code>GENERATION_ERROR = 1;</code>
     */
    const GENERATION_ERROR = 1;
    /**
     * Generated from protobuf enum <code>CHUNK_CONSUMED = 2;</code>
     */
    const CHUNK_CONSUMED = 2;
    /**
     * Generated from protobuf enum <code>TIMEOUT = 3;</code>
     */
    const TIMEOUT = 3;
    /**
     * Generated from protobuf enum <code>SESSION_EXHAUSTED = 4;</code>
     */
    const SESSION_EXHAUSTED = 4;
    /**
     * Generated from protobuf enum <code>CHUNK_EXHAUSTED = 5;</code>
     */
    const CHUNK_EXHAUSTED = 5;
    /**
     * Generated from protobuf enum <code>DUPLICATED_REQUEST = 6;</code>
     */
    const DUPLICATED_REQUEST = 6;

    private static $valueToName = [
        self::HISTORY_SYNC_CHUNK_RETRY_RESPONSE_CODE_UNSPECIFIED => 'HISTORY_SYNC_CHUNK_RETRY_RESPONSE_CODE_UNSPECIFIED',
        self::GENERATION_ERROR => 'GENERATION_ERROR',
        self::CHUNK_CONSUMED => 'CHUNK_CONSUMED',
        self::TIMEOUT => 'TIMEOUT',
        self::SESSION_EXHAUSTED => 'SESSION_EXHAUSTED',
        self::CHUNK_EXHAUSTED => 'CHUNK_EXHAUSTED',
        self::DUPLICATED_REQUEST => 'DUPLICATED_REQUEST',
    ];

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

