"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.deprecateMessage = deprecateMessage;
exports.deprecateOption = deprecateOption;
exports.deprecationLoggerEnd = deprecationLoggerEnd;

var _logger = require("./logger");

function deprecateMessage(message) {
  // eslint-disable-next-line no-use-before-define
  deprecationLoggerStart();
  (0, _logger.messageLogger)('\x1b[36m%s\x1b[0m', message);
}

function printLine() {
  deprecateMessage('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \n ');
}

let isFirstDeprecation = false;

function deprecateOption(previousObjPath = '', newObjPath = '', message = '') {
  deprecateMessage(`Please move "${previousObjPath.split('.').join(' > ')}" to "${newObjPath.split('.').join(' > ')}" following option ${message}`);
}

function deprecationLoggerStart() {
  if (!isFirstDeprecation) {
    isFirstDeprecation = true;
    printLine();
  }
}

function deprecationLoggerEnd() {
  if (isFirstDeprecation) {
    isFirstDeprecation = false;
    printLine();
  }
}