"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LEVELSCOLORS = exports.LEVELS = exports.LEVELSNAMES = exports.LogLevelAreas = exports.LevelLogs = void 0;
const Utils_js_1 = require("./Utils.js");
var LEVELSNAMES;
(function (LEVELSNAMES) {
    LEVELSNAMES["ERROR"] = "error";
    LEVELSNAMES["WARN"] = "warn";
    LEVELSNAMES["INFO"] = "info";
    LEVELSNAMES["TRACE"] = "trace";
    LEVELSNAMES["HTTP"] = "http";
    LEVELSNAMES["XMPP"] = "xmpp";
    LEVELSNAMES["DEBUG"] = "debug";
    LEVELSNAMES["INTERNALERROR"] = "internalerror";
    LEVELSNAMES["INTERNAL"] = "internal";
})(LEVELSNAMES || (exports.LEVELSNAMES = LEVELSNAMES = {}));
// order : "error", "warn", "info", "trace", "http", "xmpp", "debug", "internalerror", "internal"
var LEVELS;
(function (LEVELS) {
    LEVELS[LEVELS["error"] = 0] = "error";
    LEVELS[LEVELS["warn"] = 1] = "warn";
    LEVELS[LEVELS["info"] = 2] = "info";
    LEVELS[LEVELS["trace"] = 3] = "trace";
    LEVELS[LEVELS["http"] = 4] = "http";
    LEVELS[LEVELS["xmpp"] = 5] = "xmpp";
    LEVELS[LEVELS["debug"] = 6] = "debug";
    LEVELS[LEVELS["internalerror"] = 7] = "internalerror";
    LEVELS[LEVELS["internal"] = 8] = "internal";
})(LEVELS || (exports.LEVELS = LEVELS = {}));
// Set up logger
var LEVELSCOLORS;
(function (LEVELSCOLORS) {
    LEVELSCOLORS["error"] = "red";
    LEVELSCOLORS["warn"] = "yellow";
    LEVELSCOLORS["info"] = "green";
    LEVELSCOLORS["trace"] = "white";
    LEVELSCOLORS["http"] = "cyan";
    LEVELSCOLORS["xmpp"] = "cyan";
    LEVELSCOLORS["debug"] = "green";
    LEVELSCOLORS["internalerror"] = "red";
    LEVELSCOLORS["internal"] = "blue";
})(LEVELSCOLORS || (exports.LEVELSCOLORS = LEVELSCOLORS = {}));
class LevelLogs {
    constructor() {
    }
    //  "error", "warn", "info", "trace", "http", "xmpp", "debug", "internal", "internalerror"
    setLogLevels(obj) {
        if (obj && typeof (obj) === "object") {
            obj.ERROR = { "callerObj": obj, "level": "error", isApi: false };
            obj.WARN = { "callerObj": obj, "level": "warn", isApi: false };
            obj.INFO = { "callerObj": obj, "level": "info", isApi: false };
            obj.TRACE = { "callerObj": obj, "level": "trace", isApi: false };
            obj.HTTP = { "callerObj": obj, "level": "http", isApi: false };
            obj.XMPP = { "callerObj": obj, "level": "xmpp", isApi: false };
            obj.DEBUG = { "callerObj": obj, "level": "debug", isApi: false };
            obj.INTERNAL = { "callerObj": obj, "level": "internal", isApi: false };
            obj.INTERNALERROR = { "callerObj": obj, "level": "internalerror", isApi: false };
            obj.ERRORAPI = { "callerObj": obj, "level": "error", isApi: true };
            obj.WARNAPI = { "callerObj": obj, "level": "warn", isApi: true };
            obj.INFOAPI = { "callerObj": obj, "level": "info", isApi: true };
            obj.TRACEAPI = { "callerObj": obj, "level": "trace", isApi: true };
            obj.HTTPAPI = { "callerObj": obj, "level": "http", isApi: true };
            obj.XMPPAPI = { "callerObj": obj, "level": "xmpp", isApi: true };
            obj.DEBUGAPI = { "callerObj": obj, "level": "debug", isApi: true };
            obj.INTERNALAPI = { "callerObj": obj, "level": "internal", isApi: true };
            obj.INTERNALERRORAPI = { "callerObj": obj, "level": "internalerror", isApi: true }; // */
        }
        else {
            console.log("Can not set Logs Levels : ", (0, Utils_js_1.stackTrace)());
        }
    }
}
exports.LevelLogs = LevelLogs;
class LogLevelAreas {
    constructor(level = LEVELSNAMES.ERROR, api = false, xmppin = false, xmppout = false) {
        this.admin = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.alerts = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.bubbles = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.calllog = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.channels = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.connectedUser = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.contacts = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.conversations = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.events = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.favorites = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.fileServer = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.fileStorage = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.groups = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.httpoverxmpp = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.ims = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.invitations = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.presence = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.profiles = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.rbvoice = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.rpcoverxmpp = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.s2s = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.settings = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.tasks = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.telephony = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.version = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.webinars = {
            "category": "services",
            "api": api,
            "level": level
        };
        this.core = {
            "category": "lawlayer",
            "level": level
        };
        this.bubblesmanager = {
            "category": "lawlayer",
            "level": level
        };
        this.httpmanager = {
            "category": "lawlayer",
            "level": level
        };
        this.httpservice = {
            "category": "lawlayer",
            "level": level
        };
        this.rest = {
            "category": "lawlayer",
            "level": level
        };
        this.resttelephony = {
            "category": "lawlayer",
            "level": level
        };
        this.restconferencev2 = {
            "category": "lawlayer",
            "level": level
        };
        this.restwebinar = {
            "category": "lawlayer",
            "level": level
        };
        this.xmpp = {
            "category": "lawlayer",
            "level": level,
            "xmppin": xmppin,
            "xmppout": xmppout
        };
        this.s2sevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.rbvoiceevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.alertevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.calllogevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.channelevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.conversationevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.conversationhistory = {
            "category": "eventHandlers",
            "level": level
        };
        this.favoriteevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.httpoverxmppevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.invitationevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.iqevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.presenceevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.rpcoverxmppevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.tasksevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.telephonyevent = {
            "category": "eventHandlers",
            "level": level
        };
        this.webinarevent = {
            "category": "eventHandlers",
            "level": level
        };
    }
    //region Set Levels Methods
    configureServicesLevelLogs(level = LEVELSNAMES.INFO, api = false) {
        this.admin.level = level;
        this.admin.api = api;
        this.alerts.level = level;
        this.alerts.api = api;
        this.bubbles.level = level;
        this.bubbles.api = api;
        this.calllog.level = level;
        this.calllog.api = api;
        this.channels.level = level;
        this.channels.api = api;
        this.connectedUser.level = level;
        this.connectedUser.api = api;
        this.contacts.level = level;
        this.contacts.api = api;
        this.conversations.level = level;
        this.conversations.api = api;
        this.events.level = level;
        this.events.api = api;
        this.favorites.level = level;
        this.favorites.api = api;
        this.fileServer.level = level;
        this.fileServer.api = api;
        this.fileStorage.level = level;
        this.fileStorage.api = api;
        this.groups.level = level;
        this.groups.api = api;
        this.httpoverxmpp.level = level;
        this.httpoverxmpp.api = api;
        this.ims.level = level;
        this.ims.api = api;
        this.invitations.level = level;
        this.admin.api = api;
        this.presence.level = level;
        this.admin.api = api;
        this.profiles.level = level;
        this.admin.api = api;
        this.rbvoice.level = level;
        this.admin.api = api;
        this.rpcoverxmpp.level = level;
        this.admin.api = api;
        this.s2s.level = level;
        this.s2s.api = api;
        this.settings.level = level;
        this.settings.api = api;
        this.tasks.level = level;
        this.tasks.api = api;
        this.telephony.level = level;
        this.telephony.api = api;
        this.version.level = level;
        this.version.api = api;
        this.webinars.level = level;
        this.webinars.api = api;
    }
    configureRESTLevelLogs(level) {
        this.httpmanager.level = level;
        this.httpservice.level = level;
        this.rest.level = level;
        this.resttelephony.level = level;
        this.restconferencev2.level = level;
        this.restwebinar.level = level;
        this.xmpp.level = level;
        this.s2sevent.level = level;
    }
    configureEventsLevelLogs(level) {
        this.xmpp.level = level;
        this.s2sevent.level = level;
        this.rbvoiceevent.level = level;
        this.alertevent.level = level;
        this.calllogevent.level = level;
        this.channelevent.level = level;
        this.conversationevent.level = level;
        this.conversationhistory.level = level;
        this.favoriteevent.level = level;
        this.httpoverxmppevent.level = level;
        this.invitationevent.level = level;
        this.iqevent.level = level;
        this.presenceevent.level = level;
        this.rpcoverxmppevent.level = level;
        this.tasksevent.level = level;
        this.telephonyevent.level = level;
        this.webinarevent.level = level;
    }
    showServicesApiLogs(api = true) {
        this.admin.api = api;
        this.alerts.api = api;
        this.bubbles.api = api;
        this.calllog.api = api;
        this.channels.api = api;
        this.connectedUser.api = api;
        this.contacts.api = api;
        this.conversations.api = api;
        this.events.api = api;
        this.favorites.api = api;
        this.fileServer.api = api;
        this.fileStorage.api = api;
        this.groups.api = api;
        this.httpoverxmpp.api = api;
        this.ims.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.s2s.api = api;
        this.settings.api = api;
        this.tasks.api = api;
        this.telephony.api = api;
        this.version.api = api;
        this.webinars.api = api;
    }
    hideServicesApiLogs(api = false) {
        this.admin.api = api;
        this.alerts.api = api;
        this.bubbles.api = api;
        this.calllog.api = api;
        this.channels.api = api;
        this.connectedUser.api = api;
        this.contacts.api = api;
        this.conversations.api = api;
        this.events.api = api;
        this.favorites.api = api;
        this.fileServer.api = api;
        this.fileStorage.api = api;
        this.groups.api = api;
        this.httpoverxmpp.api = api;
        this.ims.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.admin.api = api;
        this.s2s.api = api;
        this.settings.api = api;
        this.tasks.api = api;
        this.telephony.api = api;
        this.version.api = api;
        this.webinars.api = api;
    }
    showServicesLogs(level = LEVELSNAMES.XMPP, api = true) {
        this.configureServicesLevelLogs(level, api);
    }
    hideServicesLogs(level = LEVELSNAMES.ERROR, api = false) {
        this.configureServicesLevelLogs(level, api);
    }
    showRESTLogs(level = LEVELSNAMES.XMPP) {
        this.configureRESTLevelLogs(level);
    }
    hideRESTLogs(level = LEVELSNAMES.ERROR) {
        this.configureRESTLevelLogs(level);
    }
    showEventsLogs(level = LEVELSNAMES.XMPP) {
        this.configureEventsLevelLogs(level);
    }
    hideEventsLogs(level = LEVELSNAMES.ERROR) {
        this.configureEventsLevelLogs(level);
    }
    showBubblesLogs(level = LEVELSNAMES.XMPP, api = true) {
        this.bubblesmanager.level = level;
        this.bubbles.level = level;
        this.bubbles.api = api;
    }
    hideBubblesLogs(level = LEVELSNAMES.ERROR, api = false) {
        this.bubblesmanager.level = level;
        this.bubbles.level = level;
        this.bubbles.api = api;
    }
    showAllLogs(level = LEVELSNAMES.INTERNAL, api = true) {
        let objProperties = Object.getOwnPropertyNames(this);
        for (const objPropertiesKey in objProperties) {
            console.log("initial value objPropertiesKey : ", objPropertiesKey, " -> ", this[objPropertiesKey]);
            this[objPropertiesKey].level = level;
            if ((0, Utils_js_1.isDefined)(this[objPropertiesKey].api)) {
                this[objPropertiesKey].api = level;
            }
            console.log("updated value objPropertiesKey : ", objPropertiesKey, " -> ", this[objPropertiesKey]);
        }
    }
    hideAllLogs(level = LEVELSNAMES.ERROR, api = false) {
        let objProperties = Object.getOwnPropertyNames(this);
        for (const objPropertiesKey in objProperties) {
            console.log("initial value objPropertiesKey : ", objPropertiesKey, " -> ", this[objPropertiesKey]);
            this[objPropertiesKey].level = level;
            if ((0, Utils_js_1.isDefined)(this[objPropertiesKey].api)) {
                this[objPropertiesKey].api = level;
            }
            console.log("updated value objPropertiesKey : ", objPropertiesKey, " -> ", this[objPropertiesKey]);
        }
    }
    //endregion Set Levels Methods
    //region
    toJSON() {
        return {
            admin: this.admin,
            alerts: this.alerts,
            bubbles: this.bubbles,
            calllog: this.calllog,
            channels: this.channels,
            connectedUser: this.connectedUser,
            contacts: this.contacts,
            conversations: this.conversations,
            events: this.events,
            favorites: this.favorites,
            fileServer: this.fileServer,
            fileStorage: this.fileStorage,
            groups: this.groups,
            httpoverxmpp: this.httpoverxmpp,
            ims: this.ims,
            invitations: this.invitations,
            presence: this.presence,
            profiles: this.profiles,
            rbvoice: this.rbvoice,
            rpcoverxmpp: this.rpcoverxmpp,
            s2s: this.s2s,
            settings: this.settings,
            tasks: this.tasks,
            telephony: this.telephony,
            version: this.version,
            webinars: this.webinars,
            core: this.core,
            bubblesmanager: this.bubblesmanager,
            httpmanager: this.httpmanager,
            httpservice: this.httpservice,
            rest: this.rest,
            resttelephony: this.resttelephony,
            restconferencev2: this.restconferencev2,
            restwebinar: this.restwebinar,
            xmpp: this.xmpp,
            s2sevent: this.s2sevent,
            rbvoiceevent: this.rbvoiceevent,
            alertevent: this.alertevent,
            calllogevent: this.calllogevent,
            channelevent: this.channelevent,
            conversationevent: this.conversationevent,
            conversationhistory: this.conversationhistory,
            favoriteevent: this.favoriteevent,
            httpoverxmppevent: this.httpoverxmppevent,
            invitationevent: this.invitationevent,
            iqevent: this.iqevent,
            presenceevent: this.presenceevent,
            rpcoverxmppevent: this.rpcoverxmppevent,
            telephonyevent: this.telephonyevent,
            webinarevent: this.webinarevent
        };
    }
    toString() {
        return JSON.stringify(this.toJSON());
    }
    //endregion
    //region Getters and Setters
    get admin() {
        return this._admin;
    }
    set admin(value) {
        this._admin = value;
    }
    get alertevent() {
        return this._alertevent;
    }
    set alertevent(value) {
        this._alertevent = value;
    }
    get alerts() {
        return this._alerts;
    }
    set alerts(value) {
        this._alerts = value;
    }
    get bubblesmanager() {
        return this._bubblemanager;
    }
    set bubblesmanager(value) {
        this._bubblemanager = value;
    }
    get bubbles() {
        return this._bubbles;
    }
    set bubbles(value) {
        this._bubbles = value;
    }
    get calllog() {
        return this._calllog;
    }
    set calllog(value) {
        this._calllog = value;
    }
    get calllogevent() {
        return this._calllogevent;
    }
    set calllogevent(value) {
        this._calllogevent = value;
    }
    get channelevent() {
        return this._channelevent;
    }
    set channelevent(value) {
        this._channelevent = value;
    }
    get channels() {
        return this._channels;
    }
    set channels(value) {
        this._channels = value;
    }
    get connectedUser() {
        return this._connectedUser;
    }
    set connectedUser(value) {
        this._connectedUser = value;
    }
    get contacts() {
        return this._contacts;
    }
    set contacts(value) {
        this._contacts = value;
    }
    get conversationevent() {
        return this._conversationevent;
    }
    set conversationevent(value) {
        this._conversationevent = value;
    }
    get conversationhistory() {
        return this._conversationhistory;
    }
    set conversationhistory(value) {
        this._conversationhistory = value;
    }
    get conversations() {
        return this._conversations;
    }
    set conversations(value) {
        this._conversations = value;
    }
    get core() {
        return this._core;
    }
    set core(value) {
        this._core = value;
    }
    get events() {
        return this._events;
    }
    set events(value) {
        this._events = value;
    }
    get favoriteevent() {
        return this._favoriteevent;
    }
    set favoriteevent(value) {
        this._favoriteevent = value;
    }
    get favorites() {
        return this._favorites;
    }
    set favorites(value) {
        this._favorites = value;
    }
    get fileServer() {
        return this._fileServer;
    }
    set fileServer(value) {
        this._fileServer = value;
    }
    get fileStorage() {
        return this._fileStorage;
    }
    set fileStorage(value) {
        this._fileStorage = value;
    }
    get groups() {
        return this._groups;
    }
    set groups(value) {
        this._groups = value;
    }
    get httpmanager() {
        return this._httpmanager;
    }
    set httpmanager(value) {
        this._httpmanager = value;
    }
    get httpoverxmpp() {
        return this._httpoverxmpp;
    }
    set httpoverxmpp(value) {
        this._httpoverxmpp = value;
    }
    get httpoverxmppevent() {
        return this._httpoverxmppevent;
    }
    set httpoverxmppevent(value) {
        this._httpoverxmppevent = value;
    }
    get httpservice() {
        return this._httpservice;
    }
    set httpservice(value) {
        this._httpservice = value;
    }
    get ims() {
        return this._ims;
    }
    set ims(value) {
        this._ims = value;
    }
    get invitationevent() {
        return this._invitationevent;
    }
    set invitationevent(value) {
        this._invitationevent = value;
    }
    get invitations() {
        return this._invitations;
    }
    set invitations(value) {
        this._invitations = value;
    }
    get iqevent() {
        return this._iqevent;
    }
    set iqevent(value) {
        this._iqevent = value;
    }
    get presence() {
        return this._presence;
    }
    set presence(value) {
        this._presence = value;
    }
    get presenceevent() {
        return this._presenceevent;
    }
    set presenceevent(value) {
        this._presenceevent = value;
    }
    get profiles() {
        return this._profiles;
    }
    set profiles(value) {
        this._profiles = value;
    }
    get rbvoice() {
        return this._rbvoice;
    }
    set rbvoice(value) {
        this._rbvoice = value;
    }
    get rbvoiceevent() {
        return this._rbvoiceevent;
    }
    set rbvoiceevent(value) {
        this._rbvoiceevent = value;
    }
    get rest() {
        return this._rest;
    }
    set rest(value) {
        this._rest = value;
    }
    get restconferencev2() {
        return this._restconferencev2;
    }
    set restconferencev2(value) {
        this._restconferencev2 = value;
    }
    get resttelephony() {
        return this._resttelephony;
    }
    set resttelephony(value) {
        this._resttelephony = value;
    }
    get restwebinar() {
        return this._restwebinar;
    }
    set restwebinar(value) {
        this._restwebinar = value;
    }
    get rpcoverxmpp() {
        return this._rpcoverxmpp;
    }
    set rpcoverxmpp(value) {
        this._rpcoverxmpp = value;
    }
    get rpcoverxmppevent() {
        return this._rpcoverxmppevent;
    }
    set rpcoverxmppevent(value) {
        this._rpcoverxmppevent = value;
    }
    get s2s() {
        return this._s2s;
    }
    set s2s(value) {
        this._s2s = value;
    }
    get s2sevent() {
        return this._s2sevent;
    }
    set s2sevent(value) {
        this._s2sevent = value;
    }
    get settings() {
        return this._settings;
    }
    set settings(value) {
        this._settings = value;
    }
    get tasks() {
        return this._tasks;
    }
    set tasks(value) {
        this._tasks = value;
    }
    get tasksevent() {
        return this._tasksevent;
    }
    set tasksevent(value) {
        this._tasksevent = value;
    }
    get telephony() {
        return this._telephony;
    }
    set telephony(value) {
        this._telephony = value;
    }
    get telephonyevent() {
        return this._telephonyevent;
    }
    set telephonyevent(value) {
        this._telephonyevent = value;
    }
    get version() {
        return this._version;
    }
    set version(value) {
        this._version = value;
    }
    get webinarevent() {
        return this._webinarevent;
    }
    set webinarevent(value) {
        this._webinarevent = value;
    }
    get webinars() {
        return this._webinars;
    }
    set webinars(value) {
        this._webinars = value;
    }
    get xmpp() {
        return this._xmpp;
    }
    set xmpp(value) {
        this._xmpp = value;
    }
}
exports.LogLevelAreas = LogLevelAreas;
module.exports.LevelLogs = LevelLogs;
module.exports.LogLevelAreas = LogLevelAreas;
module.exports.LEVELSNAMES = LEVELSNAMES;
module.exports.LEVELS = LEVELS;
module.exports.LEVELSCOLORS = LEVELSCOLORS;
//# sourceMappingURL=LevelLogs.js.map