from enum import Enum


SOCKETS = {
    "SERVER_PING_MS": 10 * 1000,
    "SERVER_HANDSHAKE_DISCONNECT_MS": 2 * 1000,
    "SDK_OFFLINE_MS": 11 * 1000,
    "SDK_RECONNECT_DELAY_MS": 3 * 1000,
}


class SocketEventType(Enum):
    HANDSHAKE = "HANDSHAKE"
    HANDSHAKE_SUCCESSFUL = "HANDSHAKE_SUCCESSFUL"
    SUBSCRIBE = "SUBSCRIBE"
    SUBSCRIBE_MULTIPLE_EXHIBITS = "SUBSCRIBE_MULTIPLE_EXHIBITS"
    UNSUBSCRIBE_MULTIPLE_EXHIBITS = "UNSUBSCRIBE_MULTIPLE_EXHIBITS"
    SUBSCRIBE_MULTIPLE_HARDWARE = "SUBSCRIBE_MULTIPLE_HARDWARE"
    UNSUBSCRIBE_MULTIPLE_HARDWARE = "UNSUBSCRIBE_MULTIPLE_HARDWARE"
    SUBSCRIBE_MULTIPLE_EXHIBITS_AND_HARDWARE = "SUBSCRIBE_MULTIPLE_EXHIBITS_AND_HARDWARE"
    UNSUBSCRIBE_MULTIPLE_EXHIBITS_AND_HARDWARE = "UNSUBSCRIBE_MULTIPLE_EXHIBITS_AND_HARDWARE"
    SDK = "SDK"
    ERROR = "ERROR"
    FRONTEND = "FRONTEND"
    EXHIBIT_ONLINE = "EXHIBIT_ONLINE"
    EXHIBIT_OFFLINE = "EXHIBIT_OFFLINE"
    EXHIBIT_HEALTH_UPDATED = "EXHIBIT_HEALTH_UPDATED"
    CONTROL_RECEIVED = "CONTROL_RECEIVED"
    SETTING_RECEIVED = "SETTING_RECEIVED"
    SETTING_LIST_RECEIVED = "SETTING_LIST_RECEIVED"
    SETTING_LIST_ITEM_DELETED = "SETTING_LIST_ITEM_DELETED"
    STATUS_RECEIVED = "STATUS_RECEIVED"
    OP_MODE_RECEIVED = "OP_MODE_RECEIVED"
    CONTROL_DEBUG_RECEIVED = "CONTROL_DEBUG_RECEIVED"
    CLOSE_SDK_CONNECTION = "CLOSE_SDK_CONNECTION"
    NEW_MANIFEST = "NEW_MANIFEST"
    HARDWARE_ONLINE = "HARDWARE_ONLINE"
    HARDWARE_OFFLINE = "HARDWARE_OFFLINE"
    HARDWARE_UPDATED = "HARDWARE_UPDATED"
    HARDWARE_LOG = "HARDWARE_LOG"
    HARDWARE_HEARTBEAT = "HARDWARE_HEARTBEAT"
    HARDWARE_PROPERTY_RECEIVED = "HARDWARE_PROPERTY_RECEIVED"
    MQTT_PATH_UPDATED = "MQTT_PATH_UPDATED"
    EXHIBIT_LOG = "EXHIBIT_LOG"
    EXHIBIT_TOUCHLESS_SESSION_RECEIVED = "EXHIBIT_TOUCHLESS_SESSION_RECEIVED"
    EXHIBIT_TOUCHLESS_TOKEN_ROTATED = "EXHIBIT_TOUCHLESS_TOKEN_ROTATED"
    PERIPH_EVENT = "PERIPH_EVENT"
    FILE_UPLOADED = "FILE_UPLOADED"
    FILE_DELETED = "FILE_DELETED"
    READY = "READY"
    HARDWARE_CONNECTION_TO_EXHIBIT_UPDATED = "HARDWARE_CONNECTION_TO_EXHIBIT_UPDATED"
    COMPONENT_ADDED_TO_EXHIBIT = "COMPONENT_ADDED_TO_EXHIBIT"
    COMPONENT_REMOVED_FROM_EXHIBIT = "COMPONENT_REMOVED_FROM_EXHIBIT"
    COMPONENT_CONNECTED = "COMPONENT_CONNECTED"
    COMPONENT_DISCONNECTED = "COMPONENT_DISCONNECTED"
    COMPONENT_PROPERTY_RECEIVED = "COMPONENT_PROPERTY_RECEIVED"


# Create human-friendly labels for SocketEventType
SOCKET_EVENT_LABELS = {}
for event in SocketEventType:
    name = event.name
    words = name.split("_")
    label = " ".join(word.capitalize() for word in words)
    SOCKET_EVENT_LABELS[event] = label


def get_socket_event_labels_by_type():
    """
    Returns a dictionary mapping SocketEventType enum members to human-friendly labels.
    """
    return {event: " ".join(word.capitalize() for word in event.name.split("_")) for event in SocketEventType}
