from __future__ import annotations

from collections.abc import Mapping

THEME_LABELS = {
    "dark": "Dunkel",
    "light": "Hell",
}

CLAIM_ITEM_TYPE_LABELS = {
    "base": "Grundposition",
    "product": "Produkt",
    "service": "Dienstleistung",
    "fee": "Gebühr",
    "discount": "Rabatt",
    "credit": "Gutschrift",
    "correction": "Korrektur",
}

REMINDER_STATUS_LABELS = {
    "draft": "Entwurf",
    "generated": "Dokument erzeugt",
    "sent": "Versandt",
    "cancelled": "Verworfen",
}

REMINDER_CHANNEL_LABELS = {
    "email": "E-Mail",
    "letter": "Brief",
    "personal": "Persönlich",
}

EMAIL_DELIVERY_MODE_LABELS = {
    "local": "Lokal speichern (bisheriges Verhalten)",
    "send": "Direkt versenden",
    "drafts": "Als Entwurf im Postfach ablegen",
    "ask": "Jedes Mal fragen",
}

EMAIL_SECURITY_LABELS = {
    "starttls": "STARTTLS",
    "ssl": "SSL/TLS",
    "none": "Keine",
}


def display_label(labels: Mapping[str, str], key: str) -> str:
    return labels.get(key, key)


def storage_key(labels: Mapping[str, str], label: str) -> str:
    return next((key for key, value in labels.items() if value == label), label)
