"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExceptionReason = void 0;
var http_status_codes_1 = __importDefault(require("http-status-codes"));
var HTTP_SERIES = function (statusCode) { return 100000 + statusCode; };
var reasonCodeToExceptionReasonMapper = new Map();
var ExceptionReason = /** @class */ (function () {
    function ExceptionReason(errorString, errorCode) {
        this.name = errorString;
        this.code = errorCode;
        reasonCodeToExceptionReasonMapper.set(errorCode, this);
    }
    ExceptionReason.fromHttpStatusCode = function (httpStatusCode) {
        return (reasonCodeToExceptionReasonMapper.get(HTTP_SERIES(httpStatusCode)) ||
            new ExceptionReason("HTTP_".concat(httpStatusCode), HTTP_SERIES(httpStatusCode)));
    };
    ExceptionReason.UNCAUGHT = new ExceptionReason('UNCAUGHT', 0);
    ExceptionReason.UNSUCCESSFUL_RESULT = new ExceptionReason('UNSUCCESSFUL_RESULT', 1);
    ExceptionReason.INTERNAL_ROUTING_ERROR = new ExceptionReason('INTERNAL_ROUTING_ERROR', 2);
    ExceptionReason.INCOMPATIBLE_SERVICE_RESPONSE = new ExceptionReason('INCOMPATIBLE_SERVICE_RESPONSE', 3);
    ExceptionReason.ENTITY_NOT_FOUND = new ExceptionReason('ENTITY_NOT_FOUND', 4);
    ExceptionReason.ILLEGAL_STATE = new ExceptionReason('ILLEGAL_STATE', 5);
    ExceptionReason.INVALID_ARGUMENTS = new ExceptionReason('INVALID_ARGUMENTS', 6);
    ExceptionReason.CAPTCHA_VERIFICATION_REQUIRED = new ExceptionReason('CAPTCHA_VERIFICATION_REQUIRED', 7);
    ExceptionReason.TIMEOUT = new ExceptionReason('TIMEOUT', 8);
    ExceptionReason.OTP_REQUIRED = new ExceptionReason('OTP_REQUIRED', 9);
    /* 1xxxxxx Http Series */
    ExceptionReason.HTTP_ACCEPTED = new ExceptionReason('HTTP_ACCEPTED', HTTP_SERIES(http_status_codes_1.default.ACCEPTED));
    ExceptionReason.HTTP_BAD_GATEWAY = new ExceptionReason('HTTP_BAD_GATEWAY', HTTP_SERIES(http_status_codes_1.default.BAD_GATEWAY));
    ExceptionReason.HTTP_BAD_REQUEST = new ExceptionReason('HTTP_BAD_REQUEST', HTTP_SERIES(http_status_codes_1.default.BAD_REQUEST));
    ExceptionReason.HTTP_CONFLICT = new ExceptionReason('HTTP_CONFLICT', HTTP_SERIES(http_status_codes_1.default.CONFLICT));
    ExceptionReason.HTTP_CONTINUE = new ExceptionReason('HTTP_CONTINUE', HTTP_SERIES(http_status_codes_1.default.CONTINUE));
    ExceptionReason.HTTP_CREATED = new ExceptionReason('HTTP_CREATED', HTTP_SERIES(http_status_codes_1.default.CREATED));
    ExceptionReason.HTTP_EXPECTATION_FAILED = new ExceptionReason('HTTP_EXPECTATION_FAILED', HTTP_SERIES(http_status_codes_1.default.EXPECTATION_FAILED));
    ExceptionReason.HTTP_FAILED_DEPENDENCY = new ExceptionReason('HTTP_FAILED_DEPENDENCY', HTTP_SERIES(http_status_codes_1.default.FAILED_DEPENDENCY));
    ExceptionReason.HTTP_FORBIDDEN = new ExceptionReason('HTTP_FORBIDDEN', HTTP_SERIES(http_status_codes_1.default.FORBIDDEN));
    ExceptionReason.HTTP_GATEWAY_TIMEOUT = new ExceptionReason('HTTP_GATEWAY_TIMEOUT', HTTP_SERIES(http_status_codes_1.default.GATEWAY_TIMEOUT));
    ExceptionReason.HTTP_GONE = new ExceptionReason('HTTP_GONE', HTTP_SERIES(http_status_codes_1.default.GONE));
    ExceptionReason.HTTP_HTTP_VERSION_NOT_SUPPORTED = new ExceptionReason('HTTP_HTTP_VERSION_NOT_SUPPORTED', HTTP_SERIES(http_status_codes_1.default.HTTP_VERSION_NOT_SUPPORTED));
    ExceptionReason.HTTP_IM_A_TEAPOT = new ExceptionReason('HTTP_IM_A_TEAPOT', HTTP_SERIES(http_status_codes_1.default.IM_A_TEAPOT));
    ExceptionReason.HTTP_INSUFFICIENT_SPACE_ON_RESOURCE = new ExceptionReason('HTTP_INSUFFICIENT_SPACE_ON_RESOURCE', HTTP_SERIES(http_status_codes_1.default.INSUFFICIENT_SPACE_ON_RESOURCE));
    ExceptionReason.HTTP_INSUFFICIENT_STORAGE = new ExceptionReason('HTTP_INSUFFICIENT_STORAGE', HTTP_SERIES(http_status_codes_1.default.INSUFFICIENT_STORAGE));
    ExceptionReason.HTTP_INTERNAL_SERVER_ERROR = new ExceptionReason('HTTP_INTERNAL_SERVER_ERROR', HTTP_SERIES(http_status_codes_1.default.INTERNAL_SERVER_ERROR));
    ExceptionReason.HTTP_LENGTH_REQUIRED = new ExceptionReason('HTTP_LENGTH_REQUIRED', HTTP_SERIES(http_status_codes_1.default.LENGTH_REQUIRED));
    ExceptionReason.HTTP_LOCKED = new ExceptionReason('HTTP_LOCKED', HTTP_SERIES(http_status_codes_1.default.LOCKED));
    ExceptionReason.HTTP_METHOD_FAILURE = new ExceptionReason('HTTP_METHOD_FAILURE', HTTP_SERIES(http_status_codes_1.default.METHOD_FAILURE));
    ExceptionReason.HTTP_METHOD_NOT_ALLOWED = new ExceptionReason('HTTP_METHOD_NOT_ALLOWED', HTTP_SERIES(http_status_codes_1.default.METHOD_NOT_ALLOWED));
    ExceptionReason.HTTP_MOVED_PERMANENTLY = new ExceptionReason('HTTP_MOVED_PERMANENTLY', HTTP_SERIES(http_status_codes_1.default.MOVED_PERMANENTLY));
    ExceptionReason.HTTP_MOVED_TEMPORARILY = new ExceptionReason('HTTP_MOVED_TEMPORARILY', HTTP_SERIES(http_status_codes_1.default.MOVED_TEMPORARILY));
    ExceptionReason.HTTP_MULTI_STATUS = new ExceptionReason('HTTP_MULTI_STATUS', HTTP_SERIES(http_status_codes_1.default.MULTI_STATUS));
    ExceptionReason.HTTP_MULTIPLE_CHOICES = new ExceptionReason('HTTP_MULTIPLE_CHOICES', HTTP_SERIES(http_status_codes_1.default.MULTIPLE_CHOICES));
    ExceptionReason.HTTP_NETWORK_AUTHENTICATION_REQUIRED = new ExceptionReason('HTTP_NETWORK_AUTHENTICATION_REQUIRED', HTTP_SERIES(http_status_codes_1.default.NETWORK_AUTHENTICATION_REQUIRED));
    ExceptionReason.HTTP_NO_CONTENT = new ExceptionReason('HTTP_NO_CONTENT', HTTP_SERIES(http_status_codes_1.default.NO_CONTENT));
    ExceptionReason.HTTP_NON_AUTHORITATIVE_INFORMATION = new ExceptionReason('HTTP_NON_AUTHORITATIVE_INFORMATION', HTTP_SERIES(http_status_codes_1.default.NON_AUTHORITATIVE_INFORMATION));
    ExceptionReason.HTTP_NOT_ACCEPTABLE = new ExceptionReason('HTTP_NOT_ACCEPTABLE', HTTP_SERIES(http_status_codes_1.default.NOT_ACCEPTABLE));
    ExceptionReason.HTTP_NOT_FOUND = new ExceptionReason('HTTP_NOT_FOUND', HTTP_SERIES(http_status_codes_1.default.NOT_FOUND));
    ExceptionReason.HTTP_NOT_IMPLEMENTED = new ExceptionReason('HTTP_NOT_IMPLEMENTED', HTTP_SERIES(http_status_codes_1.default.NOT_IMPLEMENTED));
    ExceptionReason.HTTP_NOT_MODIFIED = new ExceptionReason('HTTP_NOT_MODIFIED', HTTP_SERIES(http_status_codes_1.default.NOT_MODIFIED));
    ExceptionReason.HTTP_OK = new ExceptionReason('HTTP_OK', HTTP_SERIES(http_status_codes_1.default.OK));
    ExceptionReason.HTTP_PARTIAL_CONTENT = new ExceptionReason('HTTP_PARTIAL_CONTENT', HTTP_SERIES(http_status_codes_1.default.PARTIAL_CONTENT));
    ExceptionReason.HTTP_PAYMENT_REQUIRED = new ExceptionReason('HTTP_PAYMENT_REQUIRED', HTTP_SERIES(http_status_codes_1.default.PAYMENT_REQUIRED));
    ExceptionReason.HTTP_PERMANENT_REDIRECT = new ExceptionReason('HTTP_PERMANENT_REDIRECT', HTTP_SERIES(http_status_codes_1.default.PERMANENT_REDIRECT));
    ExceptionReason.HTTP_PRECONDITION_FAILED = new ExceptionReason('HTTP_PRECONDITION_FAILED', HTTP_SERIES(http_status_codes_1.default.PRECONDITION_FAILED));
    ExceptionReason.HTTP_PRECONDITION_REQUIRED = new ExceptionReason('HTTP_PRECONDITION_REQUIRED', HTTP_SERIES(http_status_codes_1.default.PRECONDITION_REQUIRED));
    ExceptionReason.HTTP_PROCESSING = new ExceptionReason('HTTP_PROCESSING', HTTP_SERIES(http_status_codes_1.default.PROCESSING));
    ExceptionReason.HTTP_PROXY_AUTHENTICATION_REQUIRED = new ExceptionReason('HTTP_PROXY_AUTHENTICATION_REQUIRED', HTTP_SERIES(http_status_codes_1.default.PROXY_AUTHENTICATION_REQUIRED));
    ExceptionReason.HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = new ExceptionReason('HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE', HTTP_SERIES(http_status_codes_1.default.REQUEST_HEADER_FIELDS_TOO_LARGE));
    ExceptionReason.HTTP_REQUEST_TIMEOUT = new ExceptionReason('HTTP_REQUEST_TIMEOUT', HTTP_SERIES(http_status_codes_1.default.REQUEST_TIMEOUT));
    ExceptionReason.HTTP_REQUEST_TOO_LONG = new ExceptionReason('HTTP_REQUEST_TOO_LONG', HTTP_SERIES(http_status_codes_1.default.REQUEST_TOO_LONG));
    ExceptionReason.HTTP_REQUEST_URI_TOO_LONG = new ExceptionReason('HTTP_REQUEST_URI_TOO_LONG', HTTP_SERIES(http_status_codes_1.default.REQUEST_URI_TOO_LONG));
    ExceptionReason.HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = new ExceptionReason('HTTP_REQUESTED_RANGE_NOT_SATISFIABLE', HTTP_SERIES(http_status_codes_1.default.REQUESTED_RANGE_NOT_SATISFIABLE));
    ExceptionReason.HTTP_RESET_CONTENT = new ExceptionReason('HTTP_RESET_CONTENT', HTTP_SERIES(http_status_codes_1.default.RESET_CONTENT));
    ExceptionReason.HTTP_SEE_OTHER = new ExceptionReason('HTTP_SEE_OTHER', HTTP_SERIES(http_status_codes_1.default.SEE_OTHER));
    ExceptionReason.HTTP_SERVICE_UNAVAILABLE = new ExceptionReason('HTTP_SERVICE_UNAVAILABLE', HTTP_SERIES(http_status_codes_1.default.SERVICE_UNAVAILABLE));
    ExceptionReason.HTTP_SWITCHING_PROTOCOLS = new ExceptionReason('HTTP_SWITCHING_PROTOCOLS', HTTP_SERIES(http_status_codes_1.default.SWITCHING_PROTOCOLS));
    ExceptionReason.HTTP_TEMPORARY_REDIRECT = new ExceptionReason('HTTP_TEMPORARY_REDIRECT', HTTP_SERIES(http_status_codes_1.default.TEMPORARY_REDIRECT));
    ExceptionReason.HTTP_TOO_MANY_REQUESTS = new ExceptionReason('HTTP_TOO_MANY_REQUESTS', HTTP_SERIES(http_status_codes_1.default.TOO_MANY_REQUESTS));
    ExceptionReason.HTTP_UNAUTHORIZED = new ExceptionReason('HTTP_UNAUTHORIZED', HTTP_SERIES(http_status_codes_1.default.UNAUTHORIZED));
    ExceptionReason.HTTP_UNPROCESSABLE_ENTITY = new ExceptionReason('HTTP_UNPROCESSABLE_ENTITY', HTTP_SERIES(http_status_codes_1.default.UNPROCESSABLE_ENTITY));
    ExceptionReason.HTTP_UNSUPPORTED_MEDIA_TYPE = new ExceptionReason('HTTP_UNSUPPORTED_MEDIA_TYPE', HTTP_SERIES(http_status_codes_1.default.UNSUPPORTED_MEDIA_TYPE));
    ExceptionReason.HTTP_USE_PROXY = new ExceptionReason('HTTP_USE_PROXY', HTTP_SERIES(http_status_codes_1.default.USE_PROXY));
    return ExceptionReason;
}());
exports.ExceptionReason = ExceptionReason;
//# sourceMappingURL=ExceptionReason.js.map