from enum import Enum from typing import Type class ProtocolChoice(Enum): WIREGUARD = "wireguard" HYSTERIA2 = "hysteria2" VLESS = "vless" SOCK5_PROXY = "proxy" # MASKED_WIREGUARD = "masked_wireguard" class Currency(Enum): MONERO = "monero" BITCOIN = "bitcoin" LITECOIN = "litecoin" LIGHTNING = "lightning" class PaymentType(Enum): CRYPTO = "crypto" TICKET = "ticket" FREE = "free" def is_valid_protocol(potential_candidate: str) -> bool: return potential_candidate in [choice.value for choice in ProtocolChoice] def get_choice_list(model: Type[Enum]) -> list: """Gets a list of tuple/name for any Enum model""" return [(e.value, e.name) for e in model] def valid_enum(potential_candidate: str, enum_model: Type[Enum]) -> bool: return potential_candidate in [choice.value for choice in enum_model]