"use strict";(function(){"use strict";var e=require("fs");var t=require("util");var r=require("events");var n=require("path");var i=require("./jsUtil");function o(){if(false===this instanceof o){return new o}f(this)}t.inherits(o,r.EventEmitter);function f(t){var r=i.getRootPath();t.content=e.readFileSync(n.resolve(r,"db/rules.json"),"utf-8");t.info=JSON.parse(t.content)}o.prototype.getSolution=function(e,t){var r=this;this.org=typeof e.org!=="undefined"?e.org:"zhengfu";if(typeof this.info==="undefined"){f(this)}var n=this.info.rules;for(var i=0;i<n.length;i++){if(n[i].name===r.org){t(n[i].rules)}}};o.prototype.getSpecificSolution=function(e,t){var r=this;this.org=typeof e.org!=="undefined"?e.org:"zhengfu";this.cfg=typeof e.cfg!=="undefined"?e.cfg:"anti-arp";var n=this.info.rules;for(var i=0;i<n.length;i++){if(n[i].name===r.org){nextDetail=n[i].rules;for(var o=0;o<nextDetail.length;o++){if(nextDetail[o].name===r.cfg){t(nextDetail[o].rules)}}}}};o.prototype.getTemplate=function(e,t){var r=this;this.org=typeof e.org!=="undefined"?e.org:"zhengfu";this.cfg=typeof e.cfg!=="undefined"?e.cfg:"anti-arp";this.solut=typeof e.solut!=="undefined"?e.solut:"anti-arp-1";var n=this.info.rules;for(var i=0;i<n.length;i++){if(n[i].name===r.org){var o=n[i].rules;for(var f=0;f<o.length;f++){if(o[f].name===r.cfg){var a=o[f].rules;for(var s=0;s<a.length;s++){if(a[s].name===r.solut){t(a[s].config_sample)}}}}}}};o.prototype.getCheckItem=function(e,t){var r=this;this.org=typeof e.org!=="undefined"?e.org:"zhengfu";this.cfg=typeof e.cfg!=="undefined"?e.cfg:"anti-arp";this.solut=typeof e.solut!=="undefined"?e.solut:"anti-arp-1";this.dev=typeof e.dev!=="undefined"?e.dev:"access";var n=this.info.rules;for(var i=0;i<n.length;i++){if(n[i].name===r.org){var o=n[i].rules;for(var f=0;f<o.length;f++){if(o[f].name===r.cfg){var a=o[f].rules;for(var s=0;s<a.length;s++){if(a[s].name===r.solut){var u=a[s].config_check;for(var g=0;g<u.length;g++){if(u[g].name===r.dev){t(u[g])}}}}}}}}};module.exports=o})();