import type { LucideIcon } from "lucide-react"; import { LayoutDashboard, CreditCard, Building2, Settings, Shield, Activity, BarChart3, Wallet, Plug, FileText, BookOpen, KeyRound, Gauge, ScrollText, Network, Eye, } from "lucide-react"; export type PortalNavItem = { href: string; label: string; bundle?: string | null }; export type PortalNavGroup = { id: string; label: string; icon: LucideIcon; href?: string; bundle?: string | null; items?: PortalNavItem[]; }; export const PAYMENT_PORTAL = { id: "payment" as const, label: "تربت‌پی", description: "پلتفرم پرداخت سازمانی — BYO-PSP و پذیرنده", basePath: "/payment", icon: CreditCard, }; export const PAYMENT_NAV: PortalNavGroup[] = [ { id: "dashboards", label: "داشبوردها", icon: LayoutDashboard, items: [ { href: "/payment/dashboard", label: "داشبورد اجرایی" }, { href: "/payment/overview", label: "نمای کلی" }, { href: "/payment/kpis", label: "شاخص‌های کلیدی" }, ], }, { id: "operations", label: "عملیات پرداخت", icon: Wallet, items: [ { href: "/payment/requests", label: "درخواست‌های پرداخت" }, { href: "/payment/transactions", label: "تراکنش‌ها" }, { href: "/payment/ledger", label: "دفتر کل" }, { href: "/payment/callbacks", label: "کال‌بک‌ها" }, { href: "/payment/verification", label: "تأیید پرداخت" }, ], }, { id: "psp", label: "درگاه‌ها (PSP)", icon: Plug, bundle: "payment.byo_psp.basic", items: [ { href: "/payment/psp", label: "مدیریت درگاه", bundle: "payment.byo_psp.basic" }, { href: "/payment/psp/health", label: "سلامت درگاه", bundle: "payment.byo_psp.basic" }, { href: "/payment/providers", label: "تخصیص ارائه‌دهنده" }, ], }, { id: "merchants", label: "پذیرندگان", icon: Building2, bundle: "payment.torbat_pay.merchant", items: [ { href: "/payment/merchants", label: "حساب‌ها", bundle: "payment.torbat_pay.merchant" }, { href: "/payment/merchants/approvals", label: "تأییدها", bundle: "payment.torbat_pay.merchant" }, ], }, { id: "licensing", label: "مجوز و باندل", icon: KeyRound, items: [ { href: "/payment/bundles", label: "باندل‌ها" }, { href: "/payment/feature-toggles", label: "کلیدهای ویژگی" }, { href: "/payment/capabilities", label: "قابلیت‌ها" }, ], }, { id: "ops", label: "عملیات پلتفرم", icon: Activity, items: [ { href: "/payment/monitoring", label: "مانیتورینگ" }, { href: "/payment/metrics", label: "متریک‌ها" }, { href: "/payment/audit", label: "حسابرسی" }, { href: "/payment/settings", label: "تنظیمات" }, ], }, { id: "dev", label: "توسعه‌دهنده", icon: Network, items: [ { href: "/payment/api-explorer", label: "کاوشگر API" }, { href: "/payment/openapi", label: "OpenAPI" }, ], }, ]; export function navForPayment() { return PAYMENT_NAV; } export function filterNavByBundles( nav: PortalNavGroup[], activeBundles: string[] | undefined ) { const bundles = new Set(activeBundles ?? []); return nav .map((g) => { if (g.bundle && !bundles.has(g.bundle)) return null; const items = g.items?.filter((i) => !i.bundle || bundles.has(i.bundle)); if (g.items && (!items || items.length === 0)) return null; return { ...g, items }; }) .filter(Boolean) as PortalNavGroup[]; } export const MVP_ROUTE_HREFS = [ "/payment/hub", "/payment/dashboard", "/payment/overview", "/payment/kpis", "/payment/transactions", "/payment/ledger", "/payment/psp", "/payment/psp/health", "/payment/providers", "/payment/merchants", "/payment/merchants/approvals", "/payment/requests", "/payment/callbacks", "/payment/verification", "/payment/audit", "/payment/bundles", "/payment/feature-toggles", "/payment/capabilities", "/payment/settings", "/payment/metrics", "/payment/monitoring", "/payment/api-explorer", "/payment/openapi", ] as const;