'use strict';
var SharedConstants = require('../constants/SharedConstants');


class ExtendableError extends Error {
  constructor(message) {
    super();
    this.message = message;
    this.stack = (new Error()).stack;
    this.name = this.constructor.name;
  }
}

class RulesetError  extends ExtendableError {
  constructor(m) {
    super(m);
  }
}




module.exports = {
    getRelatedName: function(eventName) {
        var ruleConstants = SharedConstants.RULESET_RELATIONSHIPS;
        var keys = Object.keys(ruleConstants);
        var relName;
        for (var i = 0; i < keys.length; i++) {
            if (ruleConstants[keys[i]].name === eventName) {
                relName = ruleConstants[keys[i]].relName;
                break;
            }
        }

        return relName;
    },
    RulesetError : RulesetError
};
