import enum
from typing import Final

from delta_barth.types import HttpContentHeaders

# ** error handling
DEFAULT_INTERNAL_ERR_CODE: Final[int] = 100
DEFAULT_API_ERR_CODE: Final[int] = 400


HTTP_BASE_CONTENT_HEADERS: Final[HttpContentHeaders] = {
    "Content-type": "application/json",
    "Accept": "application/json",
}


class KnownDelBarApiErrorCodes(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",
    )
)
