# --- Versioning scheme -------------------------------------------------------
# This fork tracks an upstream Electrum baseline + a BTCQ-side patch counter.
#
# ELECTRUM_VERSION    = upstream Electrum version we forked from. Frozen
#                       between rebases; bump only when rebasing onto a new
#                       upstream tag (and reset BTCQ_PATCH_VERSION to 1).
# BTCQ_PATCH_VERSION  = BTCQ-side patch counter on top of ELECTRUM_VERSION.
#                       Bump on every BTCQ-side release.
#
# Two derived strings are exported:
#   __version__       = display form, e.g. "4.7.2-btcq.3". Used by --version,
#                       wallet logs, User-Agent header, RPM %changelog,
#                       git tags ("v" + this), AppImage filename.
#   PEP440_VERSION    = "4.7.2+btcq.3". PEP 440 local-version syntax —
#                       required by setup.py because PEP 440 disallows "-"
#                       inside version strings. RPM disallows "+" in Version,
#                       which is why the spec splits Version=4.7.2 and
#                       Release=N.btcq instead.
# -----------------------------------------------------------------------------
ELECTRUM_VERSION = '4.7.2'
BTCQ_PATCH_VERSION = 6
__version__ = f"{ELECTRUM_VERSION}-btcq.{BTCQ_PATCH_VERSION}"
PEP440_VERSION = f"{ELECTRUM_VERSION}+btcq.{BTCQ_PATCH_VERSION}"

PROTOCOL_VERSION_MIN = '1.4'     # electrum protocol
PROTOCOL_VERSION_MAX = '1.6'

# The hash of the mnemonic seed must begin with this
SEED_PREFIX        = '01'      # Standard wallet
SEED_PREFIX_SW     = '100'     # Segwit wallet
SEED_PREFIX_2FA    = '101'     # Two-factor authentication
SEED_PREFIX_2FA_SW = '102'     # Two-factor auth, using segwit


def seed_prefix(seed_type):
    if seed_type == 'standard':
        return SEED_PREFIX
    elif seed_type == 'segwit':
        return SEED_PREFIX_SW
    elif seed_type == '2fa':
        return SEED_PREFIX_2FA
    elif seed_type == '2fa_segwit':
        return SEED_PREFIX_2FA_SW
    raise Exception(f"unknown seed_type: {seed_type!r}")
