'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = formatDiagnosesList;

var _chalk;

function _load_chalk() {
  return _chalk = _interopRequireDefault(require('chalk'));
}

var _table;

function _load_table() {
  return _table = require('table');
}

var _diagnosis;

function _load_diagnosis() {
  return _diagnosis = _interopRequireDefault(require('../../doctor/diagnosis'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// const NAME_COLUMN_WIDTH = 100;
// const DESCRIPTION_COLUMN_WIDTH = 30;

var tableColumnConfig = {
  columnDefault: {
    alignment: 'left'
  }
};

function createRow(diagnosis) {
  return [diagnosis.category, diagnosis.name, diagnosis.description];
}

function formatDiagnosesList(diagnosesList) {
  var header = [(_chalk || _load_chalk()).default.bold('category'), (_chalk || _load_chalk()).default.bold('name'), (_chalk || _load_chalk()).default.bold('description')];
  var rows = diagnosesList.map(createRow);
  rows.unshift(header);
  var output = (0, (_table || _load_table()).table)(rows, tableColumnConfig);
  return output;
}