/**
 * Created by Tony on 2019/5/17.
 */
let JV = require('./jpc_value_define');
let JpcEvent = {
    createNew: function (rptTpl) {
        let rst = {};
        if (rptTpl[JV.NODE_EVENTS]) {
            for (let i = 0; i < rptTpl[JV.NODE_EVENTS].length; i++) {
                let item = {};
                let propArr = Object.getOwnPropertyNames(rptTpl[JV.NODE_EVENTS][i]);
                for (let key of propArr) {
                    item[key] = rptTpl[JV.NODE_EVENTS][i][key];
                }
                switch (JV.EVENT_TYPE.indexOf(item.type)) {
                    case JV.EVENT_IDX_GRP_ON_CREATE:
                        rst[JV.EVENT_TYPE[JV.EVENT_IDX_GRP_ON_CREATE]] = item;
                        break;
                    case JV.EVENT_IDX_FLOW_CONTENT_ON_CREATE:
                        rst[JV.EVENT_TYPE[JV.EVENT_IDX_FLOW_CONTENT_ON_CREATE]] = item;
                        break;
                    default :
                        break;
                }
                //rst.push(item);
            }
        }
        return rst;
    }
};

module.exports = JpcEvent;
