from delta_barth.api.requests import (
    SalesPrognosisResult,
    SalesPrognosisResults,
    SalesPrognosisResultsExport,
)
from delta_barth.errors import STATUS_HANDLER
from delta_barth.types import (
    ApiCredentials,
    DelBarApiError,
    Status,
)


def sales_prognosis_result() -> str:
    model = SalesPrognosisResult(jahr=2023, monat=12, vorhersage=3000.3456)
    return model.model_dump_json()


def sales_prognosis_results() -> str:
    e1 = SalesPrognosisResult(jahr=2023, monat=12, vorhersage=3000.3456)
    e2 = SalesPrognosisResult(jahr=2024, monat=1, vorhersage=3300.685)
    e3 = SalesPrognosisResult(jahr=2024, monat=2, vorhersage=3700.548)
    res = (e1, e2, e3)
    model = SalesPrognosisResults(daten=res)
    return model.model_dump_json()


def sales_prognosis_results_export() -> str:
    status = STATUS_HANDLER.SUCCESS
    e1 = SalesPrognosisResult(jahr=2023, monat=12, vorhersage=3000.3456)
    e2 = SalesPrognosisResult(jahr=2024, monat=1, vorhersage=3300.685)
    e3 = SalesPrognosisResult(jahr=2024, monat=2, vorhersage=3700.548)
    res = (e1, e2, e3)
    results = SalesPrognosisResults(daten=res)
    model = SalesPrognosisResultsExport(response=results, status=status)
    return model.model_dump_json()


def delta_barth_api_error() -> str:
    err = DelBarApiError(status_code=401, message="test message", code="test code")
    return err.model_dump_json()


def status_err() -> str:
    status = Status(
        code=102,
        description="internal error occurred: 'Limit-Überschreitung'",
        message="caused by test",
    )
    return status.model_dump_json()


def api_credentials() -> str:
    model = ApiCredentials(
        username="user", password="pass", database="test1", mandant="mandant1"
    )
    return model.model_dump_json()
