from typing import Optional

from api_graphql.abc.db_model_collection_filter_abc import DbModelCollectionFilterABC
from api_graphql.abc.filter.string_filter import StringCollectionFilter
from api_graphql.abc.collection_filter_abc import FilterOperator
from core.typing import T


class PermissionFilter(DbModelCollectionFilterABC):
    def __init__(
        self,
        obj: dict,
        op: Optional[FilterOperator] = None,
        source_value: Optional[T] = None,
    ):
        DbModelCollectionFilterABC.__init__(self, obj, op, source_value)

        self.add_field("name", StringCollectionFilter)
        self.add_field("description", StringCollectionFilter)
