from __future__ import annotations

from typing import Optional

from analogai.deepthink.messaging.question_answering.factory import create_question_answering_service
from analogai.deepthink.infrastructure.gateways.llm.gateway import LlmGateway
from analogai.deepthink.startup.factories.domain_service_factory import DomainServiceFactory


class QuestionAnsweringServiceFactory:
    def __init__(
        self,
        domain_service_factory: DomainServiceFactory,
    ):
        self._domain_service_factory = domain_service_factory

    def create(
        self,
        llm_gateway_instance: Optional[LlmGateway] = None,
        fact_context_assembler=None,
        fact_context_service=None,
        fact_service=None,
    ):
        return create_question_answering_service(
            self._domain_service_factory,
            llm_gateway_instance=llm_gateway_instance,
            fact_context_assembler=fact_context_assembler,
            fact_context_service=fact_context_service,
            fact_service=fact_service,
        )
