#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import packager.taint
from visitor.persist import Persister
from config.constant import Values
import packager.behavior
import packager.uibehavior

class GroupFilter(object):
    def __init__(self):
        logger = logging.getLogger()

    def filter(self, groups,json_path):
    	raw_groups_processor = packager.taint.RawGroupsProcessor()
        group_behavior_processor = packager.behavior.GroupsBehaviorProcessor()
        groups = raw_groups_processor.process(groups)
        groups = group_behavior_processor.process(groups)

        uigroup_behavior_processor = packager.uibehavior.UIBehaviorProcessor()
        groups = uigroup_behavior_processor.process(groups)

        groupdict = [group.to_json() for group in groups]

       	Persister.json_save(groupdict,json_path)
