from api_graphql.abc.db_model_filter_abc import DbModelFilterABC
from api_graphql.abc.filter.string_filter import StringFilter
from api_graphql.filter.domain_filter import DomainFilter
from api_graphql.filter.group_filter import GroupFilter
from api_graphql.filter.user_space_filter import UserSpaceFilter


class ShortUrlFilter(DbModelFilterABC):
    def __init__(
        self,
        obj: dict,
    ):
        DbModelFilterABC.__init__(self, obj)

        self.add_field("shortUrl", StringFilter, db_name="short_url")
        self.add_field("targetUrl", StringFilter, db_name="target_url")
        self.add_field("description", StringFilter)

        self.add_field("group", GroupFilter)
        self.add_field("domain", DomainFilter)

        self.add_field("userSpace", UserSpaceFilter, "userspace")
