from abc import ABC, abstractmethod
from typing import Any, Type, Optional, Set, Dict

from . import AnyType


class DependencyContext(ABC):

    @abstractmethod
    def add_dependency_instance(self, dependency_instance: Any):
        raise NotImplementedError()

    @abstractmethod
    def add_dependency_extra_parameter(
        self,
        parameter_name: str,
        parameter_value: Any,
        for_type: Optional[AnyType] = None
    ):
        raise NotImplementedError()

    @abstractmethod
    def get_instance(self, cls: Type[AnyType], params: Optional[Dict[str, Any]] = None) -> AnyType:
        raise NotImplementedError()

    @abstractmethod
    def get_dependencies_by_parent(self, parent_type: Type[AnyType]) -> Set[Type[AnyType]]:
        raise NotImplementedError()

    @abstractmethod
    def has_instance(self, cls: Type):
        raise NotImplementedError()

    @abstractmethod
    def dispose(self):
        raise NotImplementedError()
