<?php
 
 
 

namespace PhpWA\Protocol\Proto\PaymentInfo;

use UnexpectedValueException;




class Status
{
    


    const UNKNOWN_STATUS = 0;
    


    const PROCESSING = 1;
    


    const SENT = 2;
    


    const NEED_TO_ACCEPT = 3;
    


    const COMPLETE = 4;
    


    const COULD_NOT_COMPLETE = 5;
    


    const REFUNDED = 6;
    


    const EXPIRED = 7;
    


    const REJECTED = 8;
    


    const CANCELLED = 9;
    


    const WAITING_FOR_PAYER = 10;
    


    const WAITING = 11;

    private static $valueToName = [
        self::UNKNOWN_STATUS => 'UNKNOWN_STATUS',
        self::PROCESSING => 'PROCESSING',
        self::SENT => 'SENT',
        self::NEED_TO_ACCEPT => 'NEED_TO_ACCEPT',
        self::COMPLETE => 'COMPLETE',
        self::COULD_NOT_COMPLETE => 'COULD_NOT_COMPLETE',
        self::REFUNDED => 'REFUNDED',
        self::EXPIRED => 'EXPIRED',
        self::REJECTED => 'REJECTED',
        self::CANCELLED => 'CANCELLED',
        self::WAITING_FOR_PAYER => 'WAITING_FOR_PAYER',
        self::WAITING => 'WAITING',
    ];

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

