from typing import Optional

from ariadne.types import Resolver

from api_graphql.abc.field_abc import FieldABC
from api_graphql.typing import TRequireAny
from service.permission.permissions_enum import Permissions


class SubscriptionField(FieldABC):

    def __init__(
        self,
        name: str,
        require_any_permission: list[Permissions] = None,
        require_any: TRequireAny = None,
        public: bool = False,
        resolver: Resolver = None,
        generator: Resolver = None,
    ):
        FieldABC.__init__(self, name, require_any_permission, require_any, public)

        self._resolver = resolver
        self._generator = generator

    @property
    def resolver(self) -> Optional[Resolver]:
        return self._resolver

    @property
    def generator(self) -> Optional[Resolver]:
        return self._generator
