"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = __importDefault(require("chalk"));
const compilation_status_1 = require("../lerna/enums/compilation.status");
const service_status_1 = require("../lerna/enums/service.status");
exports.getCompilationStatus = (node) => {
    if (!node.isEnabled()) {
        return chalk_1.default.grey('[Disabled]');
    }
    switch (node.getCompilationStatus()) {
        case compilation_status_1.CompilationStatus.COMPILED:
            return chalk_1.default.green('[Compiled]');
        case compilation_status_1.CompilationStatus.COMPILING:
            return chalk_1.default.cyan('[Compiling]');
        case compilation_status_1.CompilationStatus.ERROR_COMPILING:
            return chalk_1.default.red('[Error compiling]');
        case compilation_status_1.CompilationStatus.NOT_COMPILED:
            return chalk_1.default.grey('[Not compiled]');
    }
};
exports.formatPackage = (pkg) => {
    return `${exports.getCompilationStatus(pkg)}`;
};
exports.formatService = (service) => {
    const getStatus = () => {
        if (!service.isEnabled()) {
            return '';
        }
        switch (service.getStatus()) {
            case service_status_1.ServiceStatus.CRASHED:
                return chalk_1.default.bgRed('[Crashed]');
            case service_status_1.ServiceStatus.RUNNING:
                return chalk_1.default.green(`[Running on :${service.getGraph().getPort(service.getName())}]`);
            case service_status_1.ServiceStatus.STARTING:
                return chalk_1.default.cyan(`[Starting on :${service.getGraph().getPort(service.getName())}]`);
            case service_status_1.ServiceStatus.STOPPED:
                return chalk_1.default.red('[Stopped]');
            case service_status_1.ServiceStatus.STOPPING:
                return chalk_1.default.yellow('[Stopping]');
        }
    };
    return `${exports.getCompilationStatus(service)} ${getStatus()}`;
};
//# sourceMappingURL=helpers.js.map