// i18n strings — CN primary, EN secondary, AR for Saudi tax terminology
const DICT = {
  cn: {
    brand: "岁税",
    brandEn: "Suishui",
    tagline: "沙特中小企业税务合规平台",
    nav_dashboard: "总览",
    nav_vat: "增值税申报",
    nav_einvoice: "电子发票",
    nav_invoices: "发票管理",
    nav_transactions: "交易对账",
    nav_zakat: "天课",
    nav_reports: "报告分析",
    nav_calendar: "税务日历",
    nav_settings: "设置",
    nav_group_filing: "申报与发票",
    nav_group_ledger: "账务",
    nav_group_admin: "管理",
    search_placeholder: "搜索发票、交易、申报…",
    greeting_am: "早上好",
    greeting_pm: "下午好",
    greeting_eve: "晚上好",
    company: "塔米米贸易有限公司",
    company_en: "Tamimi Trading Co. LLC",
    user: "林雨晴",
    user_role: "首席财务官",

    // Dashboard
    tax_health: "税务健康",
    tax_health_en: "Tax Health",
    compliant: "合规",
    deadline_radar: "截止期雷达",
    deadline_radar_en: "Deadline Radar",
    days: "天",
    upcoming_deadlines: "即将到期",
    view_all: "全部查看",
    vat_payable: "应缴增值税",
    vat_period: "本期（2026年4月）",
    zakat_estimate: "天课估算",
    zakat_period: "本财年",
    wht_withheld: "已代扣预提税",
    wht_period: "本月累计",
    einvoice_cleared: "已清算发票",
    einvoice_period: "本月",
    ai_assistant: "AI 助手",
    ai_assistant_en: "AI Copilot",
    file_return: "提交申报",
    clear_invoice: "清算发票",
    
    // VAT flow
    vat_return: "增值税申报表",
    vat_return_en: "VAT Return",
    step_period: "期间",
    step_sales: "销项",
    step_purchases: "进项",
    step_adjustments: "调整",
    step_review: "复核",
    step_submit: "提交",

    // common
    amount_sar: "金额 (SAR)",
    status: "状态",
    date: "日期",
    supplier: "供应商",
    customer: "客户",
    invoice_no: "发票编号",
    vat_no: "增值税号",
    save_draft: "保存草稿",
    next: "下一步",
    back: "上一步",
    submit_to_zatca: "提交至 ZATCA",
    clearing: "清算中",
    cleared: "已清算",
    pending: "待处理",
    failed: "失败",
    paid: "已支付",
    overdue: "逾期",
    
    // actions
    new: "新建",
    export: "导出",
    filter: "筛选",
    
    timeline_title: "合规时间线",
    timeline_title_en: "Audit-proof Timeline",
  },
  en: {
    brand: "Suishui",
    brandEn: "岁税",
    tagline: "Tax Compliance for KSA SMEs",
    nav_dashboard: "Overview",
    nav_vat: "VAT Return",
    nav_einvoice: "E-Invoicing",
    nav_invoices: "Invoices",
    nav_transactions: "Transactions",
    nav_zakat: "Zakat",
    nav_reports: "Reports",
    nav_calendar: "Calendar",
    nav_settings: "Settings",
    nav_group_filing: "Filing & Invoicing",
    nav_group_ledger: "Ledger",
    nav_group_admin: "Admin",
    search_placeholder: "Search invoices, transactions, filings…",
    greeting_am: "Good morning",
    greeting_pm: "Good afternoon",
    greeting_eve: "Good evening",
    company: "Tamimi Trading Co. LLC",
    company_en: "塔米米贸易",
    user: "Lin Yuqing",
    user_role: "CFO",

    tax_health: "Tax Health",
    tax_health_en: "税务健康",
    compliant: "Compliant",
    deadline_radar: "Deadline Radar",
    deadline_radar_en: "截止期雷达",
    days: "days",
    upcoming_deadlines: "Upcoming deadlines",
    view_all: "View all",
    vat_payable: "VAT Payable",
    vat_period: "Current period (Apr 2026)",
    zakat_estimate: "Zakat Estimate",
    zakat_period: "This fiscal year",
    wht_withheld: "WHT Withheld",
    wht_period: "MTD",
    einvoice_cleared: "E-Invoices Cleared",
    einvoice_period: "This month",
    ai_assistant: "AI Copilot",
    ai_assistant_en: "AI 助手",
    file_return: "File Return",
    clear_invoice: "Clear Invoice",

    vat_return: "VAT Return",
    vat_return_en: "增值税申报表",
    step_period: "Period",
    step_sales: "Sales",
    step_purchases: "Purchases",
    step_adjustments: "Adjustments",
    step_review: "Review",
    step_submit: "Submit",

    amount_sar: "Amount (SAR)",
    status: "Status",
    date: "Date",
    supplier: "Supplier",
    customer: "Customer",
    invoice_no: "Invoice #",
    vat_no: "VAT #",
    save_draft: "Save draft",
    next: "Next",
    back: "Back",
    submit_to_zatca: "Submit to ZATCA",
    clearing: "Clearing",
    cleared: "Cleared",
    pending: "Pending",
    failed: "Failed",
    paid: "Paid",
    overdue: "Overdue",

    new: "New",
    export: "Export",
    filter: "Filter",

    timeline_title: "Audit-proof Timeline",
    timeline_title_en: "合规时间线",
  }
};

function useT() {
  const lang = window.__TWEAKS.language || "cn";
  const primary = DICT[lang];
  const secondary = DICT[lang === "cn" ? "en" : "cn"];
  return {
    t: (k) => primary[k] ?? k,
    en: (k) => secondary[k] ?? k, // the "other" language for sub-labels
    lang,
  };
}

window.DICT = DICT;
window.useT = useT;
