# Path: app/model/filters/filter.py
# class Filter:
#     """
#     Base class for all filters
#     """
#     __metaclass__ = abc.ABCMeta
#     def __init__(self, name, title, descr=''):
#         self.name = name
#         self.descr = descr
#         self.title = title
# 
#     @abc.abstractmethod
#     def filter(self, value):
#         """ return filter string to be appended to the livestatus query """
# 
#     @abc.abstractmethod
#     def get_col_def(self):
#         """ return list of sql_alchemy columns """ 
# 
# Path: app/model/filters/filter_text.py
# class FilterText(Filter):
#     def __init__(self, name, title, descr, column_names, operation):
#         Filter.__init__(self, name, title, descr)
#         self.operation = operation
#         self.column_names = column_names
# 
#     def filter(self, column_value):
#         if column_value:
#              return "Filter: %s %s %s\n" % (self.column_names[0], self.operation, column_value)
#         else:
#             return ""
# 
#     def get_col_def(self):
#         return [Column(self.name, String(100), info={'label':self.title})]
# 
# Path: app/model/filters/builtin.py
# OP_EQUAL = '='
# OP_TILDE = '~~'
# FILTER_HOSTREGEX = 'host_regex'
# FILTER_HOST_EXACT_MATCH = 'host'
# FILTER_SERVICE_EXACT_MATCH = 'service'
# FILTER_HOST_STATE = 'host_state'
# FILTER_SERVICE_STATE = 'service_state'
# FILTER_IS_SUMMARY_HOST = 'is_summary_host'
# FILTER_SITE = 'site'
# FILTER_IS_HOST_ACKNOWLEDGED = 'is_host_acknowledged'
# FILTER_IS_SERVICE_ACKNOWLEDGED = 'is_service_acknowledged'
# FILTER_IS_HOST_IN_NOTIFICATION_PERIOD = 'is_host_in_notification_period'
# FILTER_IS_SERVICE_IN_NOTIFICATION_PERIOD = 'is_service_in_notification_period'
# FILTER_IS_HOST_SCHEDULED_DOWNTIME_DEPTH = 'is_host_scheduled_downtime_depth'
# FILTER_IS_SERVICE_SCHEDULED_DOWNTIME_DEPTH = 'is_service_scheduled_downtime_depth'


from app.model.filters.filter import Filter
from app.model.filters.filter_text import FilterText
from app.model.filters.builtin import filters 
#   
#   Copyright (C) 2013 Savoir-Faire Linux Inc.
#   
#   This file is part of Sageo
#   
#   Sageo is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   Sageo is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with Sageo.  If not, see <http://www.gnu.org/licenses/>



class FiltersManager():
    """ A sort of proxy that facilitates filters usage. There is one FiltersManager per view display.
    """   
    def __init__(self):
        self.__filters = {}

    def set_filters(self, filters):

# Path: app/model/filters/filter.py
# class Filter:
#     """
#     Base class for all filters
#     """
#     __metaclass__ = abc.ABCMeta
#     def __init__(self, name, title, descr=''):
#         self.name = name
#         self.descr = descr
#         self.title = title
# 
#     @abc.abstractmethod
#     def filter(self, value):
#         """ return filter string to be appended to the livestatus query """
# 
#     @abc.abstractmethod
#     def get_col_def(self):
#         """ return list of sql_alchemy columns """ 
# 
# Path: app/model/filters/filter_text.py
# class FilterText(Filter):
#     def __init__(self, name, title, descr, column_names, operation):
#         Filter.__init__(self, name, title, descr)
#         self.operation = operation
#         self.column_names = column_names
# 
#     def filter(self, column_value):
#         if column_value:
#              return "Filter: %s %s %s\n" % (self.column_names[0], self.operation, column_value)
#         else:
#             return ""
# 
#     def get_col_def(self):
#         return [Column(self.name, String(100), info={'label':self.title})]
# 
# Path: app/model/filters/builtin.py
# OP_EQUAL = '='
# OP_TILDE = '~~'
# FILTER_HOSTREGEX = 'host_regex'
# FILTER_HOST_EXACT_MATCH = 'host'
# FILTER_SERVICE_EXACT_MATCH = 'service'
# FILTER_HOST_STATE = 'host_state'
# FILTER_SERVICE_STATE = 'service_state'
# FILTER_IS_SUMMARY_HOST = 'is_summary_host'
# FILTER_SITE = 'site'
# FILTER_IS_HOST_ACKNOWLEDGED = 'is_host_acknowledged'
# FILTER_IS_SERVICE_ACKNOWLEDGED = 'is_service_acknowledged'
# FILTER_IS_HOST_IN_NOTIFICATION_PERIOD = 'is_host_in_notification_period'
# FILTER_IS_SERVICE_IN_NOTIFICATION_PERIOD = 'is_service_in_notification_period'
# FILTER_IS_HOST_SCHEDULED_DOWNTIME_DEPTH = 'is_host_scheduled_downtime_depth'
# FILTER_IS_SERVICE_SCHEDULED_DOWNTIME_DEPTH = 'is_service_scheduled_downtime_depth'


# Path: app/managers/filters_manager.py
from app.model.filters.filter import Filter
from app.model.filters.filter_text import FilterText
from app.model.filters.builtin import filters 

#   
#   Copyright (C) 2013 Savoir-Faire Linux Inc.
#   
#   This file is part of Sageo
#   
#   Sageo is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   Sageo is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with Sageo.  If not, see <http://www.gnu.org/licenses/>



class FiltersManager():
    """ A sort of proxy that facilitates filters usage. There is one FiltersManager per view display.
    """   
    def __init__(self):
        self.__filters = {}

    def set_filters(self, filters):

        self.__filters = filters