<?php 
class ErrorCode {
    
    const None = 20;
    const Forbidden = 403;
    const NotFound = 404;
    const WrongData = 485;
    const WriteFailed = 486;
    const InvalidData = 487;
    const InvalidLicense = 488;
    const CouldNotReadLicense = 489;
    const Locked =423; // For License API if License Key is already in use.
    const BadRequest =400;
    const InternalServerError = 500;
    const NoResponse =0;
    
    const iCloudInvalidUserIdOrPassword = 4101;
    const iCloudInvalidSaveData = 4102;
    
    const CallrouterChannelLicenseExeeded = 5100;
    const CallrouterNoSourceEndpointFound = 5101;
    const CallrouterNoTargetEndpointFound = 5102;
    const CallrouterNoTransferToTargetEndpointFound = 5103;
    const CallrouterEndpointAccessNotAllowed = 5104;

    public static function toString($code) {
            switch ($code) {
                case  ErrorCode::None :
                    return __('ERROR_CODE_NONE');
                break;
                case  ErrorCode::Forbidden :
                    return __('ERROR_CODE_FORBIDDEN');
                break;
                case  ErrorCode::NotFound :
                    return __('ERROR_CODE_NOT_FOUND');
                break;
                case  ErrorCode::WrongData :
                    return __('ERROR_CODE_WRONG_DATA');
                break;
                case  ErrorCode::WriteFailed :
                    return __('ERROR_CODE_WRITE_FAILED');
                break;
                case  ErrorCode::InvalidData :
                    return __('ERROR_CODE_INVALIDE_DATA');
                break;
                case  ErrorCode::InvalidLicense :
                    return __('ERROR_CODE_INVALIDE_LICENSE');
                break;
                case  ErrorCode::CouldNotReadLicense :
                    return __('ERROR_CODE_COULD_NOT_READ_LICENSE');
                break;
                case ErrorCode::NoResponse:
		    return __('ERROR_CODE_NO_RESPONS');
		break;
                case ErrorCode::Locked:
                    return __('ERROR_CODE_LOCKED');
                case ErrorCode::BadRequest:
                    return __('ERROR_CODE_BAD_REQUEST');
                break;
                case ErrorCode::InternalServerError : 
                    return __("ERROR_CODE_INTERNAL_SERVER_ERROR");
                break; 
                //iCloudSync error Codes:
                case ErrorCode::iCloudInvalidUserIdOrPassword : 
                    return __('THIRDPARTYCREDENTIAL_ICLOUD_CLIENT_ERROR_INVALID_USER_PWD');
                break;
                case ErrorCode::iCloudInvalidSaveData :
                    return __('THIRDPARTYCREDENTIAL_MODEL_ICLOUD_SAVE_ERROR');
                break;
                //Callrouter error Codes :
                case  ErrorCode::CallrouterChannelLicenseExeeded :
                    return __('ERROR_CODE_CALL_ROUTER_CHANNEL_LICENSE_EXCEEDED');
                break;
                case  ErrorCode::CallrouterNoSourceEndpointFound :
                    return __('ERROR_CODE_CALL_ROUTER_NO_SOURCE_ENDPOINT_FOUND');
                break;                
                case  ErrorCode::CallrouterNoTargetEndpointFound :
                    return __('ERROR_CODE_CALL_ROUTER_NO_TARGET_ENDPOINT_FOUND');
                break;
                case  ErrorCode::CallrouterNoTransferToTargetEndpointFound :
                    return __('ERROR_CODE_CALL_ROUTER_NO_TRANSFER_TO_TARGET_ENDPOINT_FOUND');
                break;
                case  ErrorCode::CallrouterEndpointAccessNotAllowed :
                    return __('ERROR_CODE_CALL_ROUTER_ENDPOINT_ACCESS_NOT_ALLOWED');
                break;
            
                default : 
                    return __('ERROR_CODE_UNDEFINED_ERROR');
            }
    }
}