import {
  LayoutDashboard,
  BookOpen,
  MessageSquare,
  Phone,
  Calendar,
  Users,
  BarChart3,
  CreditCard,
  HelpCircle,
  UserPlus,
  Settings,
  FileText,
  Star,
  Building2,
  Eye,
  UserCheck,
  Wrench,
} from "lucide-react";
import { dashboardEn } from "@/lib/config/translations/modules/dashboard.en";
import { getSectorTransactionConfig } from "@/lib/config/sector-transaction-config";
import type { TabConfig } from "@/lib/types/dashboard.types";

type DashboardDictionary = typeof dashboardEn;

export function buildDashboardTabs(
  isAr: boolean,
  dt: DashboardDictionary,
  industryKey?: string | null,
): TabConfig[] {
  const sectorConfig = getSectorTransactionConfig(industryKey);
  const sectorTabLabel = isAr
    ? sectorConfig.tabLabel.ar
    : sectorConfig.tabLabel.en;
  const result: TabConfig[] = [
    {
      id: "overview",
      icon: <LayoutDashboard className="w-5 h-5" />,
      label: dt.tabOverview,
    },
    {
      id: "appointments",
      icon: <Calendar className="w-5 h-5" />,
      label: sectorTabLabel,
    },
    {
      id: "knowledge-base",
      icon: <BookOpen className="w-5 h-5" />,
      label: isAr ? "قاعدة المعرفة" : "Knowledge Base",
    },
    {
      id: "whatsapp",
      icon: <MessageSquare className="w-5 h-5" />,
      label: dt.tabWhatsApp,
    },
    {
      id: "voice-agent",
      icon: <Phone className="w-5 h-5" />,
      label: isAr ? "الوكيل الصوتي" : "Voice Agent",
    },
    {
      id: "customers",
      icon: <Users className="w-5 h-5" />,
      label: dt.tabClients,
    },
    {
      id: "analytics",
      icon: <BarChart3 className="w-5 h-5" />,
      label: dt.tabAnalytics,
    },
    {
      id: "reviews",
      icon: <Star className="w-5 h-5" />,
      label: isAr ? "التقييمات" : "Reviews",
    },
    {
      id: "support",
      icon: <HelpCircle className="w-5 h-5" />,
      label: isAr ? "الدعم" : "Support",
    },
    { id: "team", icon: <UserPlus className="w-5 h-5" />, label: dt.tabTeam },
    {
      id: "quotations",
      icon: <FileText className="w-5 h-5" />,
      label: isAr ? "عروض الأسعار" : "Quotations",
    },
    {
      id: "properties",
      icon: <Building2 className="w-5 h-5" />,
      label: isAr ? "العقارات" : "Properties",
    },
    {
      id: "viewings",
      icon: <Eye className="w-5 h-5" />,
      label: isAr ? "المعاينات" : "Viewings",
    },
    {
      id: "brokers",
      icon: <UserCheck className="w-5 h-5" />,
      label: isAr ? "الوسطاء" : "Brokers",
    },
    {
      id: "tenant-issues",
      icon: <Wrench className="w-5 h-5" />,
      label: isAr ? "مشاكل المستأجرين" : "Tenant Issues",
    },
    {
      id: "billing",
      icon: <CreditCard className="w-5 h-5" />,
      label: isAr ? "الفوترة" : "Billing",
    },
    {
      id: "settings",
      icon: <Settings className="w-5 h-5" />,
      label: isAr ? "الإعدادات" : "Settings",
    },
  ];
  return result;
}
