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

namespace Rv\Data\Action\TimerType;

use UnexpectedValueException;

/**
 * Protobuf type <code>rv.data.Action.TimerType.TimerAction</code>
 */
class TimerAction
{
    /**
     * Generated from protobuf enum <code>ACTION_START = 0;</code>
     */
    const ACTION_START = 0;
    /**
     * Generated from protobuf enum <code>ACTION_STOP = 1;</code>
     */
    const ACTION_STOP = 1;
    /**
     * Generated from protobuf enum <code>ACTION_RESET = 2;</code>
     */
    const ACTION_RESET = 2;
    /**
     * Generated from protobuf enum <code>ACTION_RESET_AND_START = 3;</code>
     */
    const ACTION_RESET_AND_START = 3;
    /**
     * Generated from protobuf enum <code>ACTION_STOP_AND_RESET = 4;</code>
     */
    const ACTION_STOP_AND_RESET = 4;
    /**
     * Generated from protobuf enum <code>ACTION_INCREMENT = 5;</code>
     */
    const ACTION_INCREMENT = 5;

    private static $valueToName = [
        self::ACTION_START => 'ACTION_START',
        self::ACTION_STOP => 'ACTION_STOP',
        self::ACTION_RESET => 'ACTION_RESET',
        self::ACTION_RESET_AND_START => 'ACTION_RESET_AND_START',
        self::ACTION_STOP_AND_RESET => 'ACTION_STOP_AND_RESET',
        self::ACTION_INCREMENT => 'ACTION_INCREMENT',
    ];

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

