from abc import ABC, abstractmethod

from pipelex.cogt.model_backends.backend import InferenceBackend
from pipelex.cogt.model_backends.gateway_config import GatewayConfig
from pipelex.cogt.model_backends.model_spec import InferenceModelSpec
from pipelex.cogt.model_backends.model_type import ModelType
from pipelex.cogt.models.model_deck import ModelDeck
from pipelex.system.pipelex_service.types import RemoteConfigSource
from pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract


class ModelManagerAbstract(ABC):
    @abstractmethod
    def validate_model_deck(self):
        pass

    @abstractmethod
    def teardown(self) -> None:
        pass

    @abstractmethod
    def setup(
        self,
        secrets_provider: SecretsProviderAbstract,
        gateway_config: GatewayConfig | None,
        gateway_config_source: RemoteConfigSource | None,
        needs_inference: bool = True,
    ) -> None:
        pass

    @abstractmethod
    def get_inference_model(self, model_handle: str, model_type: ModelType) -> InferenceModelSpec:
        pass

    @abstractmethod
    def get_model_deck(self) -> ModelDeck:
        pass

    @abstractmethod
    def get_required_inference_backend(self, backend_name: str) -> InferenceBackend:
        pass
