from enum import Enum


class Manufacturer(Enum):
    RESERVED = (0x000, "Reserved")
    PEHA = (0x001, "PEHA")
    THERMOKON = (0x002, "Thermokon")
    SERVODAN = (0x003, "Servodan")
    ECHOFLEX_SOLUTIONS = (0x004, "Echoflex Solutions")
    AWAG = (0x005, "AWAG Elektrotechnik AG")
    HARDMEIER_ELECTRONICS = (0x006, "Hardmeier Electronics")
    REGULVAR = (0x007, "Regulvar Inc.")
    AD_HOC_ELECTRONICS = (0x008, "Ad Hoc Electronics")
    DISTECH_CONTROLS = (0x009, "Distech Controls")
    KIEBACK_AND_PETER = (0x00A, "Kieback & Peter")
    ENOCEAN = (0x00B, "EnOcean GmbH")
    VICOS = (0x00C, "ViCOS GmbH")
    ELTAKO = (0x00D, "Eltako")
    LEVITON = (0x00E, "Leviton")
    HONEYWELL = (0x00F, "Honeywell")
    SPARTAN_PERIPHERAL_DEVICES = (0x010, "Spartan Peripheral Devices")
    SIEMENS = (0x011, "Siemens")
    T_MAC = (0x012, "T-MAC")
    RELIABLE_CONTROLS = (0x013, "Reliable Controls Corporation")
    ELSNER = (0x014, "Elsner Elektronik GmbH")
    DIEHL_CONTROLS = (0x015, "Diehl Controls")
    BSC_COMPUTER = (0x016, "BSC Computer")
    S_AND_S = (0x017, "S+S Regeltechnik GmbH")
    ZENO_CONTROLS = (0x018, "Zeno Controls or Masco Corporation")
    MASCO = (0x018, "Zeno Controls or Masco Corporation")
    INTESIS_SOFTWARE = (0x019, "Intesis Software S.L.")
    VIESSMANN = (0x01A, "Viessmann")
    LUTUO = (0x01B, "Lutuo Technology")
    CAN2GO = (0x01C, "Can2Go")
    SAUTER = (0x01D, "Sauter")
    BOOT_UP = (0x01E, "Boot-Up")
    OSRAM_SYLVANIA = (0x01F, "Osram Sylvania")
    UNOTECH = (0x020, "Unotech")
    DELTA_CONTROLS = (0x021, "Delta Controls Inc.")
    UNITRONIC = (0x022, "Unitronic AG")
    NANOSENSE = (0x023, "Nanosense")
    S4 = (0x024, "The S4 Group")
    MSR_SOLUTIONS = (0x025, "MSR Solutions GmbH (Viessmann Hausautomation GmbH)")
    GE = (0x026, "GE")
    MAICO = (0x027, "Maico")
    RUSKIN = (0x028, "Ruskin Company")
    MAGNUM_ENERGY_SOLUTIONS = (0x029, "Magnum Energy Solutions")
    KMC_CONTROLS = (0x02A, "KMC Controls")
    ECOLOGIX_CONTROLS = (0x02B, "Ecologix Controls")
    TRIO_2_SYS = (0x02C, "Trio 2 Sys")
    AFRISO_EURO_INDEX = (0x02D, "Afriso Euro Index")
    WALDMANN = (0x02E, "Waldmann GmbH")
    NEC_PLATFORMS = (0x030, "NEC Platforms Ltd.")
    ITEC = (0x031, "ITEC Corporation")
    SIMICX = (0x032, "Simicx Co., Ltd.")
    PERMUNDO = (0x033, "Permundo GmbH")
    EUROTRONIC = (0x034, "Eurotronic Technology GmbH")
    ART_JAPAN = (0x035, "ART Japan Co., Ltd.")
    TIANSU = (0x036, "Tiansu Automation Control System Co., Ltd.")
    WEINZIERL = (0x037, "Weinzierl Engineering GmbH")
    GRUPPO_GIORDANO = (0x038, "Gruppo Giordano Idea S.p.A.")
    ALPHAEOS = (0x039, "AlphaEOS AG")
    TAG = (0x03A, "TAG Technologies")
    WATTSTOPPER = (0x03B, "Wattstopper")
    PRESSAC_COMMUNICATIONS = (0x03C, "Pressac Communications Ltd.")
    GIGA_CONCEPT = (0x03E, "Giga Concept")
    SENSORTEC = (0x03F, "Sensortec")
    JAEGER_DIREKT = (0x040, "JÄGER DIREKT - Jäger Fischer GmbH & Co. KG")
    AIR_SYSTEM_COMPONENTS = (0x041, "Air System Components Inc.")
    ERMINE = (0x042, "Ermine Corp.")
    SODA = (0x043, "Soda GmbH")
    EKE_AUTOMATION = (0x044, "EKE Automation")
    HOLTER_REGELARMATUREN = (0x045, "Holter Regelarmaturen")
    ID_RF = (0x046, "ID RF")
    DEUTA = (0x047, "Deuta Controls GmbH")
    EWATTCH = (0x048, "eWattch")
    MICROPELT = (0x049, "Micropelt")
    CALEFFI = (0x04A, "Caleffi S.p.A.")
    DIGITAL_CONCEPTS = (0x04B, "Digital Concepts")
    EMERSON_CLIMATE = (0x04C, "Emerson Climate Technologies")
    ADEE_ELECTRONIC = (0x04D, "ADEE Electronic")
    ALTECON = (0x04E, "Altecon")
    NANJING_PUTIAN = (0x04F, "Nanjing Putian Telecommunications")
    TERRALUX = (0x050, "Terralux")
    MENRED = (0x051, "Menred")
    IEXERGY = (0x052, "iExergy GmbH")
    OVENTROP = (0x053, "Oventrop GmbH")
    BUILDING_AUTOMATION_PRODUCTS = (0x054, "Building Automation Products Inc.")
    FUNCTIONAL_DEVICES = (0x055, "Functional Devices Inc.")
    OGGA = (0x056, "Ogga")
    ITHO_DAALDEROP = (0x057, "Itho Daalderop")
    RESOL = (0x058, "Resol")
    ADVANCED_DEVICES = (0x059, "Advanced Devices")
    AUTANI = (0x05A, "Autani LLC")
    DR_RIEDEL = (0x05B, "Dr. Riedel GmbH")
    HOPPE = (0x05C, "Hoppe Holding AG")
    SIEGENIA_AUBI = (0x05D, "Siegenia-Aubi KG")
    ADEO_SERVICES = (0x05E, "Adeo Services")
    EIMSIG_EFP = (0x05F, "Eimsig EFP GmbH")
    VIMAR = (0x060, "Vimar S.p.A.")
    GLEN_DIMPLEX = (0x061, "Glen Dimplex GmbH")
    PMDM = (0x062, "PMDM GmbH")
    HUBBELL = (0x063, "Hubbell Lighting")
    DEBFLEX = (0x064, "Debflex")
    PERIFACTORY_SENSORSYSTEMS = (0x065, "Perifactory Sensorsystems")
    WATTY = (0x066, "Watty Corp.")
    WAGO_KONTAKTTECHNIK = (0x067, "WAGO Kontakttechnik")
    KESSEL = (0x068, "Kessel")
    AUG_WINKHAUS = (0x069, "Aug. Winkhaus")
    DECELECT = (0x06A, "Decelect")
    MST_INDUSTRIES = (0x06B, "MST Industries")
    BECKER_ANTRIEBE = (0x06C, "Becker Antriebe")
    NEXELEC = (0x06D, "Nexelec")
    WIELAND_ELECTRIC = (0x06E, "Wieland Electric")
    AVIDSEN = (0x06F, "Avidsen")
    CWS_BOCO = (0x070, "CWS-boco International")
    ROTO_FRANK = (0x071, "Roto Frank")
    ALM_CONTROLS = (0x072, "ALM Controls")
    TOMMASO = (0x073, "Tommaso Technologies")
    REHAU = (0x074, "Rehau")
    MULTI_USER_MANUFACTURER = (0x7FF, "Multi-User Manufacturer")

    # Manufacturers without a registered EnOcean Alliance code
    JUNG = (None, "Jung")
    NODON = (None, "NodOn")
    OMNIO = (None, "Omnio")

    def __init__(self, id: int | None, display_name: str):
        self.id = id
        self.display_name = display_name

    def __str__(self) -> str:
        return self.display_name

    @classmethod
    def from_id(cls, id: int) -> "Manufacturer | None":
        """Look up a member by its 11-bit EnOcean Alliance code."""
        return next((m for m in cls if m.id == id), None)
