import { localize, type Lang } from '../i18n';

/**
 * "Solutions" mega menu (header) — only modules a company owner already gets in the FleetTruck360 dashboard.
 * Each link opens the features page section that explains it.
 */
export const solutionGroups = [
  { title: 'Core Platform', items: [
    { label: 'Digital Trip Sheets', icon: 'journal-text', href: '/features/#trip-sheets' },
    { label: 'Trip Approval Workflow', icon: 'check2-square', href: '/features/#trip-sheets' },
    { label: 'Trip Templates & Duplicate', icon: 'bookmark-star', href: '/features/#trip-sheets' },
    { label: 'Team Drivers', icon: 'people-fill', href: '/features/#trip-sheets' },
    { label: 'Driver Mobile App', icon: 'phone', href: '/features/#mobile' },
    { label: 'Owner Dashboard', icon: 'speedometer2', href: '/features/#dashboard' },
  ] },
  { title: 'Operations', items: [
    { label: 'Live Dispatch & GPS Tracking', icon: 'broadcast', href: '/features/#dispatch' },
    { label: 'Trucks & Trailers', icon: 'truck', href: '/features/#fleet' },
    { label: 'Truck Maintenance', icon: 'tools', href: '/features/#fleet' },
    { label: 'Employees & Drivers', icon: 'people', href: '/features/#fleet' },
    { label: 'Shippers & Consignees', icon: 'building', href: '/features/#fleet' },
    { label: 'Road Repairs & Breakdowns', icon: 'tools', href: '/features/#trip-sheets' },
    { label: 'Fuel Stops & Receipts', icon: 'fuel-pump', href: '/features/#trip-sheets' },
    { label: 'Printable Trip Sheet PDF', icon: 'file-earmark-pdf', href: '/features/#trip-sheets' },
    { label: 'Company Documents & Contacts', icon: 'folder2-open', href: '/features/#documents' },
    { label: 'Announcements & Notifications', icon: 'megaphone', href: '/features/#team' },
  ] },
  { title: 'Financial', items: [
    { label: 'Driver Settlements', icon: 'cash-stack', href: '/features/#settlements' },
    { label: 'Expenses & Receipts', icon: 'receipt', href: '/features/#expenses' },
    { label: 'Revenue & Net Profit', icon: 'graph-up-arrow', href: '/features/#dashboard' },
    { label: 'Reports & Analytics', icon: 'bar-chart', href: '/features/#dashboard' },
  ] },
  { title: 'Compliance & Safety', items: [
    { label: 'State Mileage & IFTA Tax', icon: 'map', href: '/features/#ifta' },
    { label: 'IFTA Return Export with Receipts', icon: 'file-earmark-zip', href: '/features/#ifta' },
    { label: 'Driver Qualification Files', icon: 'person-vcard', href: '/features/#compliance' },
    { label: 'Company Filings Calendar', icon: 'calendar2-check', href: '/features/#compliance' },
    { label: 'Online Driver Applications', icon: 'person-plus', href: '/features/#compliance' },
    { label: 'Document Expiry Alerts', icon: 'calendar-x', href: '/features/#fleet' },
    { label: 'Audit Log', icon: 'clock-history', href: '/features/#team' },
  ] },
  { title: 'Team & Support', items: [
    { label: 'Users, Roles & Permissions', icon: 'shield-lock', href: '/features/#team' },
    { label: 'Company Profile & Settings', icon: 'person-gear', href: '/features/#team' },
    { label: 'Help Center & Guided Tours', icon: 'life-preserver', href: '/faq/' },
    { label: 'Support Tickets', icon: 'headset', href: '/contact/' },
  ] },
] as const;

/** Spanish labels, same order as above (links and icons are shared) */
const ES: { title: string; items: string[] }[] = [
  { title: 'Plataforma principal', items: ['Hojas de viaje digitales', 'Aprobación de viajes', 'Plantillas y duplicar viajes', 'Choferes en equipo', 'App móvil para choferes', 'Panel del dueño'] },
  { title: 'Operaciones', items: ['Despacho en vivo y rastreo GPS', 'Camiones y remolques', 'Mantenimiento de camiones', 'Empleados y choferes', 'Remitentes y destinatarios', 'Reparaciones y averías en ruta', 'Paradas de combustible y recibos', 'Hoja de viaje en PDF para imprimir', 'Documentos y contactos de la empresa', 'Avisos y notificaciones'] },
  { title: 'Finanzas', items: ['Liquidaciones de choferes', 'Gastos y recibos', 'Ingresos y ganancia neta', 'Reportes y análisis'] },
  { title: 'Cumplimiento y seguridad', items: ['Millas por estado e impuesto IFTA', 'Declaración IFTA exportada con recibos', 'Expedientes de choferes (DQF)', 'Calendario de trámites de la empresa', 'Solicitudes de choferes en línea', 'Alertas de vencimiento de documentos', 'Registro de auditoría'] },
  { title: 'Equipo y soporte', items: ['Usuarios, roles y permisos', 'Perfil y ajustes de la empresa', 'Centro de ayuda y recorridos guiados', 'Tickets de soporte'] },
];

/** the menu in the page language, with links pointing to the pages in that language */
export function solutionsFor(lang: Lang) {
  const tr = ({ es: ES } as Partial<Record<Lang, typeof ES>>)[lang];
  return solutionGroups.map((g, gi) => ({
    title: tr?.[gi].title ?? g.title,
    items: g.items.map((it, i) => ({ ...it, label: tr?.[gi].items[i] ?? it.label, href: localize(it.href, lang) })),
  }));
}
