<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: core/Tron.proto

namespace Protocol\Transaction\Result;

use UnexpectedValueException;

/**
 * Protobuf type <code>protocol.Transaction.Result.contractResult</code>
 */
class contractResult
{
    /**
     * Generated from protobuf enum <code>DEFAULT = 0;</code>
     */
    const PBDEFAULT = 0;
    /**
     * Generated from protobuf enum <code>SUCCESS = 1;</code>
     */
    const SUCCESS = 1;
    /**
     * Generated from protobuf enum <code>REVERT = 2;</code>
     */
    const REVERT = 2;
    /**
     * Generated from protobuf enum <code>BAD_JUMP_DESTINATION = 3;</code>
     */
    const BAD_JUMP_DESTINATION = 3;
    /**
     * Generated from protobuf enum <code>OUT_OF_MEMORY = 4;</code>
     */
    const OUT_OF_MEMORY = 4;
    /**
     * Generated from protobuf enum <code>PRECOMPILED_CONTRACT = 5;</code>
     */
    const PRECOMPILED_CONTRACT = 5;
    /**
     * Generated from protobuf enum <code>STACK_TOO_SMALL = 6;</code>
     */
    const STACK_TOO_SMALL = 6;
    /**
     * Generated from protobuf enum <code>STACK_TOO_LARGE = 7;</code>
     */
    const STACK_TOO_LARGE = 7;
    /**
     * Generated from protobuf enum <code>ILLEGAL_OPERATION = 8;</code>
     */
    const ILLEGAL_OPERATION = 8;
    /**
     * Generated from protobuf enum <code>STACK_OVERFLOW = 9;</code>
     */
    const STACK_OVERFLOW = 9;
    /**
     * Generated from protobuf enum <code>OUT_OF_ENERGY = 10;</code>
     */
    const OUT_OF_ENERGY = 10;
    /**
     * Generated from protobuf enum <code>OUT_OF_TIME = 11;</code>
     */
    const OUT_OF_TIME = 11;
    /**
     * Generated from protobuf enum <code>JVM_STACK_OVER_FLOW = 12;</code>
     */
    const JVM_STACK_OVER_FLOW = 12;
    /**
     * Generated from protobuf enum <code>UNKNOWN = 13;</code>
     */
    const UNKNOWN = 13;
    /**
     * Generated from protobuf enum <code>TRANSFER_FAILED = 14;</code>
     */
    const TRANSFER_FAILED = 14;

    private static $valueToName = [
        self::PBDEFAULT => 'PBDEFAULT',
        self::SUCCESS => 'SUCCESS',
        self::REVERT => 'REVERT',
        self::BAD_JUMP_DESTINATION => 'BAD_JUMP_DESTINATION',
        self::OUT_OF_MEMORY => 'OUT_OF_MEMORY',
        self::PRECOMPILED_CONTRACT => 'PRECOMPILED_CONTRACT',
        self::STACK_TOO_SMALL => 'STACK_TOO_SMALL',
        self::STACK_TOO_LARGE => 'STACK_TOO_LARGE',
        self::ILLEGAL_OPERATION => 'ILLEGAL_OPERATION',
        self::STACK_OVERFLOW => 'STACK_OVERFLOW',
        self::OUT_OF_ENERGY => 'OUT_OF_ENERGY',
        self::OUT_OF_TIME => 'OUT_OF_TIME',
        self::JVM_STACK_OVER_FLOW => 'JVM_STACK_OVER_FLOW',
        self::UNKNOWN => 'UNKNOWN',
        self::TRANSFER_FAILED => 'TRANSFER_FAILED',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(contractResult::class, \Protocol\Transaction_Result_contractResult::class);

