from dishka import STRICT_VALIDATION, AsyncContainer, make_async_container
from dishka.integrations.fastapi import FastapiProvider

from template_project.ml.configuration import Configuration, ServerConfiguration
from template_project.ml.ioc.embedding import EmbeddingProvider
from template_project.ml.ioc.interactor import InteractorProvider
from template_project.ml.ioc.model import ModelProvider


def make_ioc(configuration: Configuration) -> AsyncContainer:
    return make_async_container(
        ModelProvider(),
        EmbeddingProvider(),
        InteractorProvider(),
        FastapiProvider(),
        validation_settings=STRICT_VALIDATION,
        context={
            ServerConfiguration: configuration.server,
            Configuration: configuration,
        },
    )
