from abc import ABC
from typing import Optional

from api_graphql.typing import TRequireAny
from service.permission.permissions_enum import Permissions


class FieldABC(ABC):

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

        self._require_any_permission = require_any_permission
        self._require_any = require_any
        self._public = public

    @property
    def name(self) -> str:
        return self._name

    @property
    def require_any_permission(self) -> Optional[list[Permissions]]:
        return self._require_any_permission

    @property
    def require_any(self) -> Optional[TRequireAny]:
        return self._require_any

    @property
    def public(self) -> bool:
        return self._public
