text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
  
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  var _ReportType = require('../types/ReportType');
  
  var _ReportType2 = _interopRequireDefault(_ReportType);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  /**
   * Provides a wrapper for analysis errors stored in the `errors` array for each report type.
   */
  var AnalyzeError = function () {
    /**
     * Initializes an instance.
     *
     * @param {string}   severity - Provides the severity level.
     * @param {string}   message - Provides the error message.
     * @param {ClassMethodReport|ClassReport|ModuleMethodReport|ModuleReport|ProjectReport} sourceReport -
     *                   The source report of the error.
     */
    function AnalyzeError() {
      var severity = arguments.length <= 0 || arguments[0] === undefined ? '<unknown>' : arguments[0];
      var message = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];
      var sourceReport = arguments.length <= 2 || arguments[2] === undefined ? void 0 : arguments[2];
  
      _classCallCheck(this, AnalyzeError);
  
      /**
       * Provides the line number where the error starts.
       * @type {number}
       */
      this.lineStart = (typeof sourceReport === 'undefined' ? 'undefined' : _typeof(sourceReport)) === 'object' ? sourceReport.lineStart : 0;
  
      /**
       * Provides the line number where the error starts.
       * @type {number}
       */
      this.lineEnd = (typeof sourceReport === 'undefined' ? 'undefined' : _typeof(sourceReport)) === 'object' ? sourceReport.lineEnd : 0;
  
      /**
       * Provides the severity level.
       * @type {string}
       */
      this.severity = severity;
  
      /**
       * Provides the error message.
       * @type {string}
       */
      this.message = message;
  
      /**
       * Attempt to find the `name` then try `srcPath` for modules.
       */
      this.name = (typeof sourceReport === 'undefined' ? 'undefined' : _typeof(sourceReport)) === 'object' ? sourceReport.getName() : '';
  
      /**
       * Provides a type of report where the error is found.
       * @type {string}
       */
      this.type = (typeof sourceReport === 'undefined' ? 'undefined' : _typeof(sourceReport)) === 'object' ? sourceReport.type : void 0;
    }
  
    /**
     * Deserializes a JSON object representing a AnalyzeError.
     *
     * @param {object}   object - A JSON object of a AnalyzeError that was previously serialized.
     *
     * @returns {AnalyzeError}
     */
  
  
    _createClass(AnalyzeError, [{
      key: 'toString',
  
  
      /**
       * Returns a verbose string about the error.
       * @returns {string}
       */
      value: function toString() {
        return '(' + this.severity + ') ' + this.message + ' @ ' + this.type.description + ' ' + (this.name !== '' ? '- ' + this.name + ' ' : '') + '(' + this.lineStart + ' - ' + this.lineEnd + ')';
      }
    }], [{
      key: 'parse',
      value: function parse(object) {
        /* istanbul ignore if */
        if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) !== 'object') {
          throw new TypeError('parse error: \'object\' is not an \'object\'.');
        }
  
        var error = Object.assign(new AnalyzeError(), object);
  
        // Deserialize the associated enum type.
        error.type = _ReportType2.default.enumValueOf(object.type.name);
  
        return error;
      }
    }]);
  
    return AnalyzeError;
  }();
  
  exports.default = AnalyzeError;
  module.exports = exports['default'];