from hypertube.utils.ConnectionType import ConnectionType
from hypertube.utils.connectionData.IConnectionData import IConnectionData


DEFAULT_CONNECT_TIMEOUT_SECONDS = 60


class WsConnectionData(IConnectionData):

    def __init__(self, hostname: str, connect_timeout_in_seconds: int = DEFAULT_CONNECT_TIMEOUT_SECONDS):
        super().__init__()
        self._hostname = hostname
        self._connect_timeout_in_seconds = connect_timeout_in_seconds

    @property
    def connection_type(self):
        return ConnectionType.WebSocket

    @property
    def hostname(self):
        return self._hostname

    def serialize_connection_data(self):
        return [self.connection_type.value, 0, 0, 0, 0, 0, 0]

    @hostname.setter
    def hostname(self, value):
        self._hostname = value

    @property
    def connect_timeout_in_seconds(self):
        return self._connect_timeout_in_seconds

    @connect_timeout_in_seconds.setter
    def connect_timeout_in_seconds(self, value):
        self._connect_timeout_in_seconds = value
