import enum
from typing import Final

from delta_barth.types import CurrentConnection, HttpContentHeaders

# ** API connection management
HTTP_BASE_CONTENT_HEADERS: Final[HttpContentHeaders] = {
    "Content-type": "application/json",
    "Accept": "application/json",
}

HTTP_CURRENT_CONNECTION: Final[CurrentConnection] = CurrentConnection(
    HTTP_BASE_CONTENT_HEADERS
)


class KnownApiErrorCodes(enum.Enum):
    COMMON = frozenset((400, 401, 409, 500))


# ** API response parsing
# ** column mapping [API-Response --> Target-Features]
COL_MAP_SALES_PROGNOSIS: Final[dict[str, str]] = {
    "artikelId": "artikel_refid",
    "firmaId": "firma_refid",
    "betrag": "betrag",
    "menge": "menge",
    "buchungsDatum": "buchungs_datum",
}
FEATURES_SALES_PROGNOSIS: Final[frozenset[str]] = frozenset(
    (
        "firma_refid",
        "betrag",
        "buchungs_datum",
    )
)
