"""
SIA Codes
"""

from enum import StrEnum
from typing import Final


class SIACode(StrEnum):
    """
    SIA Codes
    """

    AC_RESTORAL: Final = "AR"
    AC_TROUBLE: Final = "AT"
    BURGLARY_ALARM: Final = "BA"
    BURGLARY_BYPASS: Final = "BB"
    BURGLARY_CANCEL: Final = "BC"
    SWINGER_TROUBLE: Final = "BD"
    SWINGER_TROUBLE_RESTORE: Final = "BE"
    BURGLARY_TROUBLE_RESTORE: Final = "BJ"
    BURGLARY_RESTORAL: Final = "BR"
    BURGLARY_TROUBLE: Final = "BT"
    BURGLARY_UNBYPASS: Final = "BU"
    BURGLARY_VERIFIED: Final = "BV"
    BURGLARY_TEST: Final = "BX"
    CLOSING_DELINQUENT: Final = "CD"
    FORCED_CLOSING: Final = "CF"
    CLOSE_AREA: Final = "CG"
    FAIL_TO_CLOSE: Final = "CI"
    EARLY_TO_CLOSE: Final = "CK"
    CLOSING_REPORT: Final = "CL"
    AUTOMATIC_CLOSING: Final = "CP"
    REMOTE_CLOSING: Final = "CQ"
    CLOSING_KEYSWITCH: Final = "CS"
    LATE_TO_OPEN: Final = "CT"
    ACCESS_CLOSED: Final = "DC"
    ACCESS_DENIED: Final = "DD"
    DOOR_FORCED: Final = "DF"
    ACCESS_GRANTED: Final = "DG"
    ACCESS_DENIED_PASSBACK: Final = "DI"
    DOOR_LEFT_OPEN: Final = "DN"
    ACCESS_OPEN: Final = "DO"
    DOOR_RESTORAL: Final = "DR"
    REQUEST_TO_EXIT: Final = "DX"
    EXIT_ALARM: Final = "EA"
    EXPANSION_TAMPER_RESTORE: Final = "EJ"
    EXPANSION_MISSING: Final = "EM"
    EXPANSION_MISSING_RESTORE: Final = "EN"
    EXPANSION_RESTORAL: Final = "ER"
    EXPANSION_DEVICE_TAMPER: Final = "ES"
    EXPANSION_TROUBLE: Final = "ET"
    FIRE_ALARM: Final = "FA"
    FIRE_BYPASS: Final = "FB"
    FIRE_CANCEL: Final = "FC"
    FIRE_TROUBLE_RESTORE: Final = "FJ"
    FIRE_RESTORAL: Final = "FR"
    FIRE_TROUBLE: Final = "FT"
    FIRE_UNBYPASS: Final = "FU"
    HOLDUP_ALARM: Final = "HA"
    HOLDUP_BYPASS: Final = "HB"
    HOLDUP_TROUBLE_RESTORE: Final = "HJ"
    HOLDUP_RESTORAL: Final = "HR"
    HOLDUP_TROUBLE: Final = "HT"
    HOLDUP_UNBYPASS: Final = "HU"
    CONFIRMED_HOLDUP: Final = "HV"
    USER_CODE_TAMPER: Final = "JA"
    TIME_CHANGED: Final = "JT"
    LOCAL_PROGRAMMING: Final = "LB"
    MODEM_RESTORAL: Final = "LR"
    MODEM_TROUBLE: Final = "LT"
    LOCAL_PROGRAMMING_ENDED: Final = "LX"
    MEDICAL_ALARM: Final = "MA"
    MEDICAL_BYPASS: Final = "MB"
    MEDICAL_TROUBLE_RESTORE: Final = "MJ"
    MEDICAL_RESTORAL: Final = "MR"
    MEDICAL_TROUBLE: Final = "MT"
    MEDICAL_UNBYPASS: Final = "MU"
    PERIMETER_ARMED: Final = "NL"
    NETWORK_LINK_IP_RESTORE: Final = "NR"
    NETWORK_LINK_GPRS_RESTORE: Final = "NR"
    NETWORK_LINK_IP_FAIL: Final = "NT"
    NETWORK_LINK_GPRS_FAIL: Final = "NT"
    AUTOMATIC_OPENING: Final = "OA"
    OPEN_AREA: Final = "OG"
    EARLY_OPEN: Final = "OK"
    OPENING_REPORT: Final = "OP"
    OPENING_KEYSWITCH: Final = "OS"
    LATE_TO_CLOSE: Final = "OT"
    REMOTE_OPENING: Final = "OQ"
    DISARM_FROM_ALARM: Final = "OR"
    PANIC_ALARM: Final = "PA"
    PANIC_BYPASS: Final = "PB"
    PANIC_TROUBLE_RESTORE: Final = "PJ"
    PANIC_RESTORAL: Final = "PR"
    PANIC_TROUBLE: Final = "PT"
    PANIC_UNBYPASS: Final = "PU"
    RELAY_CLOSE: Final = "RC"
    REMOTE_RESET: Final = "RN"
    RELAY_OPEN: Final = "RO"
    AUTOMATIC_TEST: Final = "RP"
    POWERUP: Final = "RR"
    REMOTE_PROGRAM_SUCCESS: Final = "RS"
    DATA_LOST: Final = "RT"
    MANUAL_TEST: Final = "RX"
    TAMPER: Final = "TA"
    TAMPER_BYPASS: Final = "TB"
    TAMPER_RESTORAL: Final = "TR"
    TAMPER_UNBYPASS: Final = "TU"
    TEST_CALL: Final = "TX"
    UNTYPED_ALARM: Final = "UA"
    UNTYPED_BYPASS: Final = "UB"
    UNTYPED_TROUBLE_RESTORE: Final = "UJ"
    UNTYPED_RESTORAL: Final = "UR"
    UNTYPED_TROUBLE: Final = "UT"
    UNTYPED_UNBYPASS: Final = "UU"
    BELL_FAULT: Final = "YA"
    RF_JAM_RESTORAL: Final = "XH"
    RF_TAMPER_RESTORAL: Final = "XJ"
    READER_LOCKED: Final = "RL"
    READER_UNLOCKED: Final = "RG"
    KEYPAD_UNLOCKED: Final = "KG"
    RF_JAM_FAULT: Final = "XQ"
    RF_TAMPER: Final = "XS"
    COMMUNICATION_FAIL: Final = "YC"
    CHECKSUM_FAULT: Final = "YF"
    BELL_RESTORED: Final = "YH"
    COMMUNICATION_RESTORAL: Final = "YK"
    BATTERY_MISSING: Final = "YM"
    PSU_TROUBLE: Final = "YP"
    PSU_RESTORAL: Final = "YQ"
    BATTERY_RESTORAL: Final = "YR"
    COMMUNICATION_TROUBLE: Final = "YS"
    BATTERY_TROUBLE: Final = "YT"
    WATCHDOG_RESET: Final = "YW"
    SERVICE_REQUIRED: Final = "YX"
    SERVICE_COMPLETED: Final = "YZ"
    # Special SIA events
    USER_DURESS: Final = "HA"
    USER_DURESS_RESTORE: Final = "HR"
    ENET_PANIC_ALARM: Final = "PA"
    ENET_PANIC_RESTORAL: Final = "PR"
    USER_PANIC_ALARM: Final = "PA"
    ENET_FIRE_ALARM: Final = "FA"
    ENET_FIRE_RESTORAL: Final = "FR"
    ENET_MEDICAL_ALARM: Final = "MA"
    ENET_MEDICAL_RESTORAL: Final = "MR"
    MDT_PANIC: Final = "PA"
    MDT_TILT: Final = "MA"
    MDT_BELT_CLIP: Final = "HA"
    MDT_PANIC_RESTORE: Final = "PR"
    MDT_TILT_RESTORE: Final = "MR"
    MDT_BELT_CLIP_RESTORE: Final = "HR"
    RPA_PANIC: Final = "PA"
    RPA_PANIC_RESTORE: Final = "PR"
    RPA_HOLDUP: Final = "HA"
    RPA_HOLDUP_RESTORE: Final = "HR"
    USER_CODE_CHANGE: Final = "JV"

    # Non-standard SIA codes for zone state reporting
    ZONE_OPEN: Final = "ZO"
    ZONE_CLOSE: Final = "ZC"
    ZONE_SHORT: Final = "ZX"
    ZONE_DISCON: Final = "ZD"
    ZONE_MASKED: Final = "ZM"
    ZONE_WALKED: Final = "TP"
    WALKTEST_START: Final = "ZK"
    WALKTEST_END: Final = "TC"
    ZONE_LOW_BATT: Final = "XT"
    ZONE_LOW_BATTERY_RESTORAL: Final = "XR"

    # Other non-standard SIA codes
    CAMERA_ONLINE: Final = "CU"
    CAMERA_OFFLINE: Final = "CV"
    ALERT_CLOSE: Final = "SD"
    ALERT_REOPEN: Final = "SO"
    XBUS_ALERT_CLOSE: Final = "NB"
    XBUS_ALERT_REOPEN: Final = "NO"
    UNKNOWN_CARD: Final = "AU"
    USER_ACCESSING: Final = "JP"
    USER_ACCESSING_END: Final = "ZG"
    LOW_VOLTAGE: Final = "XD"
    LOW_VOLTAGE_RESTORAL: Final = "XG"
    DEEP_CHARGE: Final = "XK"
    LOCKED_OUT: Final = "WW"

    def __repr__(self) -> str:
        return self.name
