from __future__ import annotations

from typing import Optional

from analogai.deepthink.infrastructure.gateways.llm.gateway import LlmGateway
from analogai.deepthink.presentation.pipeline.pipeline import MessagePipeline
from analogai.deepthink.startup.factories.domain_service_factory import DomainServiceFactory


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

    def create_message_pipeline(
        self,
        notion_enrichment_enabled: Optional[bool] = None,
        llm_gateway_instance: Optional[LlmGateway] = None,
    ) -> MessagePipeline:
        from analogai.deepthink.startup.bootstrap import create_pipeline
        return create_pipeline(
            domain_service_factory=self._domain_service_factory,
            notion_enrichment_enabled=notion_enrichment_enabled,
            llm_gateway_instance=llm_gateway_instance,
        )
