# ==========================================================
# SIMPLE TRANSLATION SYSTEM (no external i18n library needed)
# Supports 3 modes: "en" (English), "bn" (Bangla), "both"
# ==========================================================

TRANSLATIONS = {
    # ---------- Brand / Topbar ----------
    "business_pos":        {"en": "Business POS",        "bn": "ব্যবসা পস"},
    "overview":            {"en": "Overview",             "bn": "সারসংক্ষেপ"},
    "dashboard":           {"en": "Dashboard",            "bn": "ড্যাশবোর্ড"},

    # ---------- Sales ----------
    "sales_section":       {"en": "Sales",                "bn": "বিক্রয়"},
    "sell_pos":             {"en": "Sell (POS)",           "bn": "বিক্রি করুন (পস)"},
    "sales_history":       {"en": "Sales History",        "bn": "বিক্রয় ইতিহাস"},
    "held_sales":          {"en": "Held Sales",           "bn": "স্থগিত বিক্রয়"},
    "coupons":             {"en": "Coupons",              "bn": "কুপন"},
    "sales_returns":       {"en": "Sales Returns",        "bn": "বিক্রয় ফেরত"},

    # ---------- Inventory ----------
    "inventory_section":   {"en": "Inventory",            "bn": "মজুদ"},
    "products":            {"en": "Products",             "bn": "পণ্য"},
    "purchase":            {"en": "Purchase",             "bn": "ক্রয়"},
    "purchase_orders":     {"en": "Purchase Orders",      "bn": "ক্রয় অর্ডার"},
    "purchase_history":    {"en": "Purchase History",     "bn": "ক্রয় ইতিহাস"},
    "stock_report":        {"en": "Stock Report",         "bn": "মজুদ প্রতিবেদন"},
    "low_stock_alert":     {"en": "Low Stock Alert",      "bn": "কম মজুদ সতর্কতা"},
    "stock_adjustment":    {"en": "Stock Adjustment",     "bn": "মজুদ সমন্বয়"},
    "barcode_print":       {"en": "Barcode Print",        "bn": "বারকোড প্রিন্ট"},

    # ---------- Reports ----------
    "reports_section":     {"en": "Reports",              "bn": "প্রতিবেদন"},
    "daily_report":        {"en": "Daily Report",         "bn": "দৈনিক প্রতিবেদন"},
    "monthly_report":      {"en": "Monthly Report",       "bn": "মাসিক প্রতিবেদন"},
    "expenses":            {"en": "Expenses",             "bn": "খরচ"},

    # ---------- People ----------
    "people_section":      {"en": "People",               "bn": "মানুষ"},
    "customers":           {"en": "Customers",            "bn": "গ্রাহক"},
    "suppliers":           {"en": "Suppliers",            "bn": "সরবরাহকারী"},
    "supplier_ledger":     {"en": "Supplier Ledger",      "bn": "সরবরাহকারী হিসাব"},

    # ---------- Administration ----------
    "administration":      {"en": "Administration",       "bn": "প্রশাসন"},
    "users_roles":         {"en": "Users & Roles",        "bn": "ব্যবহারকারী ও ভূমিকা"},
    "audit_log":           {"en": "Audit Log",            "bn": "অডিট লগ"},
    "backups":             {"en": "Backups",              "bn": "ব্যাকআপ"},
    "shop_settings":       {"en": "Shop Settings",        "bn": "দোকান সেটিংস"},

    # ---------- Account ----------
    "account":             {"en": "Account",              "bn": "অ্যাকাউন্ট"},
    "logout":              {"en": "Logout",               "bn": "লগআউট"},

    # ---------- Language switcher labels ----------
    "language":            {"en": "Language",             "bn": "ভাষা"},
}


def translate(key, lang="en"):
    """
    Returns the translated string for a given key based on the
    active language mode:
      - "en"   -> English only
      - "bn"   -> Bangla only
      - "both" -> "English (বাংলা)"
    Falls back to the key itself if not found.
    """

    entry = TRANSLATIONS.get(key)

    if not entry:
        return key

    en_text = entry.get("en", key)
    bn_text = entry.get("bn", key)

    if lang == "bn":
        return bn_text

    if lang == "both":
        return f"{en_text} ({bn_text})"

    # default: english
    return en_text
