"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

function _chalk() {
  const data = _interopRequireDefault(require("chalk"));

  _chalk = function () {
    return data;
  };

  return data;
}

function _table() {
  const data = require("table");

  _table = function () {
    return data;
  };

  return data;
}

function _diagnosis() {
  const data = _interopRequireDefault(require("../../doctor/diagnosis"));

  _diagnosis = function () {
    return data;
  };

  return data;
}

// const NAME_COLUMN_WIDTH = 100;
// const DESCRIPTION_COLUMN_WIDTH = 30;
const tableColumnConfig = {
  columnDefault: {
    alignment: 'left'
  }
};

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

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