"""Constants for the Nina integration."""

from datetime import timedelta
from logging import Logger, getLogger
from typing import Final

LOGGER: Logger = getLogger(__package__)

SCAN_INTERVAL: timedelta = timedelta(minutes=5)

DOMAIN: str = "nina"

NO_MATCH_REGEX: str = "/(?!)/"
ALL_MATCH_REGEX: str = ".*"

SEVERITY_VALUES: list[str] = ["extreme", "severe", "moderate", "minor", "unknown"]

SERVICE_GET_DETAILS: str = "get_details"

SERVICE_DATA_HEADLINE: str = "headline"
SERVICE_DATA_DESCRIPTION: str = "description"
SERVICE_DATA_SENDER: str = "sender"
SERVICE_DATA_SEVERITY: str = "severity"
SERVICE_DATA_RECOMMENDED_ACTIONS: str = "recommended_actions"
SERVICE_DATA_AFFECTED_AREAS: str = "affected_areas"
SERVICE_DATA_WEB: str = "web"
SERVICE_DATA_ID: str = "id"
SERVICE_DATA_SENT: str = "sent"
SERVICE_DATA_START: str = "start"
SERVICE_DATA_EXPIRES: str = "expires"

CONF_REGIONS: str = "regions"
CONF_MESSAGE_SLOTS: str = "slots"
CONF_FILTERS: str = "filters"
CONF_FILTER_CORONA: str = "corona_filter"  # deprecated
CONF_HEADLINE_FILTER: str = "headline_filter"
CONF_AREA_FILTER: str = "area_filter"

ATTR_HEADLINE: str = "headline"
ATTR_DESCRIPTION: str = "description"
ATTR_SENDER: str = "sender"
ATTR_SEVERITY: str = "severity"
ATTR_RECOMMENDED_ACTIONS: str = "recommended_actions"
ATTR_AFFECTED_AREAS: str = "affected_areas"
ATTR_WEB: str = "web"
ATTR_SENT: str = "sent"
ATTR_START: str = "start"
ATTR_EXPIRES: str = "expires"

SENSOR_SUFFIXES: list[str] = [
    "headline",
    "sender",
    "severity",
    "affected_areas",
    "more_info_url",
    "sent",
    "start",
    "expires",
]

CONST_LIST_A_TO_D: list[str] = ["A", "Ä", "B", "C", "D"]
CONST_LIST_E_TO_H: list[str] = ["E", "F", "G", "H"]
CONST_LIST_I_TO_L: list[str] = ["I", "J", "K", "L"]
CONST_LIST_M_TO_Q: list[str] = ["M", "N", "O", "Ö", "P", "Q"]
CONST_LIST_R_TO_U: list[str] = ["R", "S", "T", "U", "Ü"]
CONST_LIST_V_TO_Z: list[str] = ["V", "W", "X", "Y", "Z"]

CONST_REGION_A_TO_D: Final = "_a_to_d"
CONST_REGION_E_TO_H: Final = "_e_to_h"
CONST_REGION_I_TO_L: Final = "_i_to_l"
CONST_REGION_M_TO_Q: Final = "_m_to_q"
CONST_REGION_R_TO_U: Final = "_r_to_u"
CONST_REGION_V_TO_Z: Final = "_v_to_z"
CONST_REGIONS: Final = [
    CONST_REGION_A_TO_D,
    CONST_REGION_E_TO_H,
    CONST_REGION_I_TO_L,
    CONST_REGION_M_TO_Q,
    CONST_REGION_R_TO_U,
    CONST_REGION_V_TO_Z,
]

CONST_REGION_MAPPING: dict[str, list[str]] = {
    CONST_REGION_A_TO_D: CONST_LIST_A_TO_D,
    CONST_REGION_E_TO_H: CONST_LIST_E_TO_H,
    CONST_REGION_I_TO_L: CONST_LIST_I_TO_L,
    CONST_REGION_M_TO_Q: CONST_LIST_M_TO_Q,
    CONST_REGION_R_TO_U: CONST_LIST_R_TO_U,
    CONST_REGION_V_TO_Z: CONST_LIST_V_TO_Z,
}
