from typing import Optional

from api_graphql.abc.filter.bool_filter import BoolFilter
from api_graphql.abc.filter.date_filter import DateFilter
from api_graphql.abc.filter.fuzzy_filter import FuzzyFilter
from api_graphql.abc.filter.int_filter import IntFilter
from api_graphql.abc.filter.string_filter import StringFilter
from api_graphql.abc.filter_abc import FilterABC


class DbModelFilterABC[T](FilterABC[T]):
    def __init__(
        self,
        obj: Optional[dict],
    ):
        FilterABC.__init__(self, obj)
        from api_graphql.filter.user_filter import UserFilter

        self.add_field("id", IntFilter)
        self.add_field("deleted", BoolFilter)
        self.add_field("editor", UserFilter)
        self.add_field("created", DateFilter)
        self.add_field("updated", DateFilter)

        self.add_field("fuzzy", FuzzyFilter)
