#     Copyright 2021. FastyBird s.r.o.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

"""
Shelly connector plugin types
"""

# Python base dependencies
from enum import Enum, unique

# Library dependencies
from modules_metadata.devices_module import (
    DevicePropertyName as MetaDataDevicePropertyName,
)


@unique
class ClientMessageType(Enum):
    """
    Client message type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    COAP_STATUS: str = "CoAP-status"
    COAP_DESCRIPTION: str = "CoAP-discovery"
    MDNS: str = "mDns-discovery"
    HTTP_SHELLY: str = "http-shelly"
    HTTP_STATUS: str = "http-status"
    HTTP_DESCRIPTION: str = "http-description"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class SensorType(Enum):
    """
    Block sensor type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    ALARM: str = "A"
    BATTERY_LEVEL: str = "B"
    CONCENTRATION: str = "C"
    ENERGY: str = "E"
    EVENT: str = "EV"
    EVENT_COUNTER: str = "EVC"
    HUMIDITY: str = "H"
    CURRENT: str = "I"
    LUMINOSITY: str = "L"
    POWER: str = "P"
    STATUS: str = "S"
    TEMPERATURE: str = "T"
    VOLTAGE: str = "V"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class SensorUnit(Enum):
    """
    Block sensor unit

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    WATTS: str = "W"
    WATT_MINUTES: str = "Wmin"
    WATT_HOURS: str = "Wh"
    VOLTS: str = "V"
    AMPERES: str = "A"
    CELSIUS: str = "C"
    FAHRENHEIT: str = "F"
    KELVIN: str = "K"
    DEGREES: str = "deg"
    LUX: str = "lux"
    PARTS_PER_MILLION: str = "ppm"
    SECONDS: str = "s"
    PERCENT: str = "pct"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class ClientType(Enum):
    """
    Plugin client type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    COAP: str = "coap"
    MDNS: str = "mdns"
    HTTP: str = "http"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class WritableSensor(Enum):
    """
    List of sensors which could be written

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    MODE: str = "mode"
    OUTPUT: str = "output"
    ROLLER: str = "roller"
    RED: str = "red"
    GREEN: str = "green"
    BLUE: str = "blue"
    WHITE: str = "white"
    GAIN: str = "gain"
    COLOR_TEMP: str = "colorTemp"
    BRIGHTNESS: str = "brightness"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceAttribute(Enum):
    """
    Devices attribute name

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    IP_ADDRESS: str = MetaDataDevicePropertyName.IP_ADDRESS.value
    UPTIME: str = MetaDataDevicePropertyName.UPTIME.value
    RSSI: str = MetaDataDevicePropertyName.RSSI.value
    STATE: str = MetaDataDevicePropertyName.STATE.value
    AUTH_ENABLED: str = "auth-enabled"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceDescriptionSource(Enum):
    """
    Source of provided description

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    COAP_DESCRIPTION: str = "coap-description"
    MDNS_DISCOVERY: str = "mdns-discovery"
    HTTP_SHELLY: str = "http-shelly"
    HTTP_STATUS: str = "http-status"
    HTTP_DESCRIPTION: str = "http-description"
    MANUAL: str = "manual"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceCommandType(Enum):
    """
    Device command type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    GET_SHELLY: str = "get-shelly"
    GET_STATUS: str = "get-status"
    GET_DESCRIPTION: str = "get-description"
    SET_SENSOR: str = "set-sensor"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class RelayPayload(Enum):
    """
    Output as relay supported payload

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    ON: str = "on"
    OFF: str = "off"
    TOGGLE: str = "toggle"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class LightSwitchPayload(Enum):
    """
    Output as light bulb supported payload

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    ON: str = "on"
    OFF: str = "off"
    TOGGLE: str = "toggle"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceType(Enum):
    """
    Known device types

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    SHELLY_1: str = "shsw-1"
    SHELLY_1_PM: str = "shsw-pm"
    SHELLY_1_L: str = "shsw-l"
    SHELLY_2: str = "shsw-21"
    SHELLY_25: str = "shsw-25"
    SHELLY_I3: str = "shix3-1"
    SHELLY_RGBW_2: str = "shrgbw2"
    SHELLY_DIMMER_1: str = "shdm-1"
    SHELLY_DIMMER_2: str = "shdm-2"
    SHELLY_EM: str = "shem"
    SHELLY_3_EM: str = "shem-3"
    SHELLY_UNI: str = "shuni-1"
    SHELLY_PRO_4_PM: str = "shsw-44"
    SHELLY_PLUS_1: str = "shellyplus1"
    SHELLY_PLUS_1_PM: str = "shellyplus1pm"
    SHELLY_PLUG: str = "shplg-1"
    SHELLY_PLUG_S: str = "shplg-s"
    SHELLY_PLUG_US: str = "shplg-u1"
    SHELLY_BULB: str = "shblb-1"
    SHELLY_BULB_RGBW: str = "shcb-1"
    SHELLY_VINTAGE: str = "shvin-1"
    SHELLY_DUO: str = "shbduo-1"
    SHELLY_BUTTON_1: str = "shbtn-1"
    SHELLY_USB_LED_STRIP: str = ""
    SHELLY_MOTION: str = "shmos-01"
    SHELLY_HT: str = "shht-1"
    SHELLY_FLOOD: str = "shwt-1"
    SHELLY_DOOR_WINDOW_1: str = "shdw-1"
    SHELLY_DOOR_WINDOW_2: str = "shdw-2"
    SHELLY_GAS: str = "shgs-1"

#     Copyright 2021. FastyBird s.r.o.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

"""
Shelly connector plugin types
"""

# Python base dependencies
from enum import Enum, unique

# Library dependencies
from modules_metadata.devices_module import (
    DevicePropertyName as MetaDataDevicePropertyName,
)


@unique
class ClientMessageType(Enum):
    """
    Client message type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    COAP_STATUS: str = "CoAP-status"
    COAP_DESCRIPTION: str = "CoAP-discovery"
    MDNS: str = "mDns-discovery"
    HTTP_SHELLY: str = "http-shelly"
    HTTP_STATUS: str = "http-status"
    HTTP_DESCRIPTION: str = "http-description"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class SensorType(Enum):
    """
    Block sensor type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    ALARM: str = "A"
    BATTERY_LEVEL: str = "B"
    CONCENTRATION: str = "C"
    ENERGY: str = "E"
    EVENT: str = "EV"
    EVENT_COUNTER: str = "EVC"
    HUMIDITY: str = "H"
    CURRENT: str = "I"
    LUMINOSITY: str = "L"
    POWER: str = "P"
    STATUS: str = "S"
    TEMPERATURE: str = "T"
    VOLTAGE: str = "V"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class SensorUnit(Enum):
    """
    Block sensor unit

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    WATTS: str = "W"
    WATT_MINUTES: str = "Wmin"
    WATT_HOURS: str = "Wh"
    VOLTS: str = "V"
    AMPERES: str = "A"
    CELSIUS: str = "C"
    FAHRENHEIT: str = "F"
    KELVIN: str = "K"
    DEGREES: str = "deg"
    LUX: str = "lux"
    PARTS_PER_MILLION: str = "ppm"
    SECONDS: str = "s"
    PERCENT: str = "pct"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class ClientType(Enum):
    """
    Plugin client type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    COAP: str = "coap"
    MDNS: str = "mdns"
    HTTP: str = "http"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class WritableSensor(Enum):
    """
    List of sensors which could be written

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    MODE: str = "mode"
    OUTPUT: str = "output"
    ROLLER: str = "roller"
    RED: str = "red"
    GREEN: str = "green"
    BLUE: str = "blue"
    WHITE: str = "white"
    GAIN: str = "gain"
    COLOR_TEMP: str = "colorTemp"
    BRIGHTNESS: str = "brightness"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceAttribute(Enum):
    """
    Devices attribute name

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    IP_ADDRESS: str = MetaDataDevicePropertyName.IP_ADDRESS.value
    UPTIME: str = MetaDataDevicePropertyName.UPTIME.value
    RSSI: str = MetaDataDevicePropertyName.RSSI.value
    STATE: str = MetaDataDevicePropertyName.STATE.value
    AUTH_ENABLED: str = "auth-enabled"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceDescriptionSource(Enum):
    """
    Source of provided description

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    COAP_DESCRIPTION: str = "coap-description"
    MDNS_DISCOVERY: str = "mdns-discovery"
    HTTP_SHELLY: str = "http-shelly"
    HTTP_STATUS: str = "http-status"
    HTTP_DESCRIPTION: str = "http-description"
    MANUAL: str = "manual"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceCommandType(Enum):
    """
    Device command type

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    GET_SHELLY: str = "get-shelly"
    GET_STATUS: str = "get-status"
    GET_DESCRIPTION: str = "get-description"
    SET_SENSOR: str = "set-sensor"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class RelayPayload(Enum):
    """
    Output as relay supported payload

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    ON: str = "on"
    OFF: str = "off"
    TOGGLE: str = "toggle"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class LightSwitchPayload(Enum):
    """
    Output as light bulb supported payload

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    ON: str = "on"
    OFF: str = "off"
    TOGGLE: str = "toggle"

    # -----------------------------------------------------------------------------

    @classmethod
    def has_value(cls, value: str) -> bool:
        """Check if value exists in enum"""
        return value in cls._value2member_map_  # pylint: disable=no-member


@unique
class DeviceType(Enum):
    """
    Known device types

    @package        FastyBird:ShellyConnectorPlugin!
    @module         types

    @author         <NAME> <<EMAIL>>
    """

    SHELLY_1: str = "shsw-1"
    SHELLY_1_PM: str = "shsw-pm"
    SHELLY_1_L: str = "shsw-l"
    SHELLY_2: str = "shsw-21"
    SHELLY_25: str = "shsw-25"
    SHELLY_I3: str = "shix3-1"
    SHELLY_RGBW_2: str = "shrgbw2"
    SHELLY_DIMMER_1: str = "shdm-1"
    SHELLY_DIMMER_2: str = "shdm-2"
    SHELLY_EM: str = "shem"
    SHELLY_3_EM: str = "shem-3"
    SHELLY_UNI: str = "shuni-1"
    SHELLY_PRO_4_PM: str = "shsw-44"
    SHELLY_PLUS_1: str = "shellyplus1"
    SHELLY_PLUS_1_PM: str = "shellyplus1pm"
    SHELLY_PLUG: str = "shplg-1"
    SHELLY_PLUG_S: str = "shplg-s"
    SHELLY_PLUG_US: str = "shplg-u1"
    SHELLY_BULB: str = "shblb-1"
    SHELLY_BULB_RGBW: str = "shcb-1"
    SHELLY_VINTAGE: str = "shvin-1"
    SHELLY_DUO: str = "shbduo-1"
    SHELLY_BUTTON_1: str = "shbtn-1"
    SHELLY_USB_LED_STRIP: str = ""
    SHELLY_MOTION: str = "shmos-01"
    SHELLY_HT: str = "shht-1"
    SHELLY_FLOOD: str = "shwt-1"
    SHELLY_DOOR_WINDOW_1: str = "shdw-1"
    SHELLY_DOOR_WINDOW_2: str = "shdw-2"
    SHELLY_GAS: str = "shgs-1"

#     Copyright 2021. FastyBird s.r.o. # #     Licensed under the Apache License, Version 2.0 (the "License"); #     you may not use this file except in compliance with the License. #     You may obtain a copy of the License at # #         http://www.apache.org/licenses/LICENSE-2.0 # #     Unless required by applicable law or agreed to in writing, software #     distributed under the License is distributed on an "AS IS" BASIS, #     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #     See the License for the specific language governing permissions and #     limitations under the License. Shelly connector plugin types # Python base dependencies # Library dependencies Client message type      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Block sensor type      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Block sensor unit      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Plugin client type      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member List of sensors which could be written      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Devices attribute name      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Source of provided description      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Device command type      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Output as relay supported payload      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Output as light bulb supported payload      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>> # ----------------------------------------------------------------------------- Check if value exists in enum # pylint: disable=no-member Known device types      @package        FastyBird:ShellyConnectorPlugin!     @module         types      @author         <NAME> <<EMAIL>>