"use strict";

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

function _bluebird() {
  const data = require("bluebird");

  _bluebird = function () {
    return data;
  };

  return data;
}

class Diagnosis {
  /**
   * A function that actually runs the examination
   */
  _runExamine() {
    return (0, _bluebird().coroutine)(function* () {
      throw new Error('You must implement this method');
    })();
  }
  /**
   * Returns a descriptive symptoms message which might include specific data from the examination
   * @param bareResult ExamineBareResult
   */
  // eslint-disable-next-line no-unused-vars


  _formatSymptoms(bareResult) {
    throw new Error('You must implement this method');
  }
  /**
   * Returns a descriptive instruction to handle the issue (might include specific data from the examination)
   * @param bareResult ExamineBareResult
   */
  // eslint-disable-next-line no-unused-vars


  _formatManualTreat(bareResult) {
    throw new Error('You must implement this method');
  }

  getMeta() {
    return {
      category: this.category,
      name: this.name,
      description: this.description
    };
  }

  examine() {
    var _this = this;

    return (0, _bluebird().coroutine)(function* () {
      const bareResult = yield _this._runExamine();

      if (bareResult.valid) {
        return {
          diagnosisMetaData: _this.getMeta(),
          bareResult,
          formattedSymptoms: '',
          formattedManualTreat: ''
        };
      }

      const formattedSymptoms = _this._formatSymptoms(bareResult);

      const formattedManualTreat = _this._formatManualTreat(bareResult);

      return {
        diagnosisMetaData: _this.getMeta(),
        bareResult,
        formattedSymptoms,
        formattedManualTreat
      };
    })();
  }

}

exports.default = Diagnosis;