PAYLOAD_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~!$&'()*+,;=:@"
QR_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"

SEGMENT_ALPHABETS = {
  0: "0123456789",
  1: "abcdefghijklmnopqrstuvwxyz",
  2: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
  3: "abcdefghijklmnopqrstuvwxyz0123456789-",
  4: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
  5: "0123456789ABCDEFabcdef",
  6: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$&'()*+,;=:@",
  7: None,  # raw UTF-8 bytes fallback
}

ALPHABET_NAMES = {
  0: "decimal",
  1: "lowercase",
  2: "uppercase",
  3: "domain-like",
  4: "base64url-like",
  5: "hex",
  6: "url-safe",
  7: "utf8-raw",
}

CODE_VERSION = 2
SUPPORTED_CODE_VERSIONS = {1, 2}
TLD_CODE_WIDTH = 6
DOMAIN_CODE_WIDTH = 6
LEGACY_DICTIONARY_CODE_WIDTH = 4

CODE_PREFIX_PAYLOAD = "u"
CODE_PREFIX_QR = "Q"
MODE_STRUCTURED = "structured"
MODE_QR_STRUCTURED = "qr-structured"
MODE_DECODED = "decoded"

SCHEME_CODES = {"http": 0, "https": 1}
CODE_SCHEMES = {value: key for key, value in SCHEME_CODES.items()}
ALLOWED_REDIRECT_SCHEMES = {"http", "https"}

COMMON_TLDS = [
  "", "com", "org", "net", "io", "dev", "at", "de", "edu", "gov", "co", "uk",
  "app", "ai", "me", "info", "biz", "xyz", "online", "site", "shop", "store",
  "blog", "tech", "cloud", "digital", "tools", "software", "systems", "network",
  "eu", "us", "ca", "au", "ch", "fr", "it", "es", "nl", "se", "no", "fi",
  "dk", "pl", "cz", "jp", "cn", "in", "br", "ru", "tv", "fm", "to", "gg",
]
COMMON_DOMAINS = [
  "", "google", "youtube", "github", "reddit", "wikipedia", "twitter", "x",
  "facebook", "instagram", "amazon", "microsoft", "apple", "cloudflare", "stackoverflow",
  "linkedin", "tiktok", "whatsapp", "telegram", "discord", "slack", "notion", "medium",
  "wordpress", "openai", "anthropic", "claude", "chatgpt", "docker", "kubernetes", "terraform",
  "githubusercontent", "gitlab", "bitbucket", "npmjs", "pypi", "python", "nodejs", "mozilla",
  "cloudfront", "aws", "azure", "googleapis", "gstatic", "vercel", "netlify", "heroku",
  "paypal", "stripe", "shopify", "ebay", "etsy", "twitch", "spotify", "netflix",
  "adobe", "figma", "canva", "atlassian", "jira", "confluence", "zoom", "dropbox",
]
SEPARATORS = "/?&=#.:-_~%+"
