#
#     MiAuth - Authenticate and interact with Xiaomi devices over BLE
#     Copyright (C) 2021-2022  Daljeet Nandha
#
#     This program is free software: you can redistribute it and/or modify
#     it under the terms of the GNU Affero General Public License as
#     published by the Free Software Foundation, either version 3 of the
#     License, or (at your option) any later version.
#
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU Affero General Public License for more details.
#
#     You should have received a copy of the GNU Affero General Public License
#     along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
class UUID(object):
    UART = "6e400001-b5a3-f393-e0a9-e50e24dcca9e"
    TX = "6e400002-b5a3-f393-e0a9-e50e24dcca9e"
    RX = "6e400003-b5a3-f393-e0a9-e50e24dcca9e"
    AUTH = "0000fe95-0000-1000-8000-00805f9b34fb"
    UPNP = "00000010-0000-1000-8000-00805f9b34fb"
    AVDTP = "00000019-0000-1000-8000-00805f9b34fb"
    KEY = "00000014-0000-1000-8000-00805f9b34fb"

    @staticmethod
    def from_hex(val):
        if val.lower() == UUID.UART.replace("-", ""):
            return UUID.UART
        elif val.lower() == UUID.TX.replace("-", ""):
            return UUID.TX
        elif val.lower() == UUID.RX.replace("-", ""):
            return UUID.RX
        elif val.lower() == UUID.AUTH.replace("-", ""):
            return UUID.AUTH
        elif val.lower() == UUID.UPNP.replace("-", ""):
            return UUID.UPNP
        elif val.lower() == UUID.AVDTP.replace("-", ""):
            return UUID.AVDTP
        elif val.lower() == UUID.KEY.replace("-", ""):
            return UUID.KEY
