"""collection of configured data pipelines, intended to be invoked from C#"""

from datetime import datetime as Datetime

from delta_barth.analysis import forecast
from delta_barth.logging import logger_pipelines as logger
from delta_barth.management import SESSION
from delta_barth.types import JsonExportResponse


def pipeline_sales_forecast(
    company_id: int | None,
    start_date: Datetime | None,
) -> JsonExportResponse:
    logger.info("[EXT-CALL PIPELINES] Starting main sales forecast pipeline...")
    result = forecast.pipeline_sales_forecast(
        SESSION, company_id=company_id, start_date=start_date
    )
    export = JsonExportResponse(result.model_dump_json())

    logger.info("[EXT-CALL PIPELINES] Main sales forecast pipeline successful")

    return export


def pipeline_sales_forecast_dummy(
    company_id: int | None,
    start_date: Datetime | None,
) -> JsonExportResponse:
    logger.info("[EXT-CALL PIPELINES] Starting dummy sales forecast pipeline...")
    result = forecast.pipeline_sales_dummy(
        SESSION,
        company_id=company_id,
        start_date=start_date,
    )
    export = JsonExportResponse(result.model_dump_json())

    logger.info("[EXT-CALL PIPELINES] Dummy sales forecast pipeline successful")

    return export
