/**
 * Service-type → conditional nav-entry map.
 *
 * Each configured service type contributes ONE top-level nav entry that
 * appears only when at least one enabled instance of that type exists. The
 * label is the service TYPE name (Jellyfin, SSH Tasks), not a conceptual
 * name (Media, Files) — the service page's content tabs surface the concepts.
 */
import {
	Activity,
	DatabaseBackup,
	GanttChartSquare,
	Monitor,
	Server,
	Users,
	type LucideIcon,
} from "lucide-react";

export interface NavEntry {
	serviceType: string;
	label: string;
	icon: LucideIcon;
	/** Route path for this entry. */
	path: string;
}

/**
 * Static mapping from service type to its conditional nav entry.
 * Uses the service type's display name. One entry per type.
 * `nextcloud` has no entry (no operational content tabs).
 */
export const SERVICE_TYPE_NAV_ENTRIES: NavEntry[] = [
	{
		serviceType: "jellyfin",
		label: "Jellyfin",
		icon: Monitor,
		path: "/services/jellyfin",
	},
	{
		serviceType: "ssh_tasks",
		label: "SSH Tasks",
		icon: Server,
		path: "/services/ssh_tasks",
	},
	{
		serviceType: "alertmanager",
		label: "Alertmanager",
		icon: Activity,
		path: "/services/alertmanager",
	},
	{
		serviceType: "prometheus",
		label: "Prometheus",
		icon: GanttChartSquare,
		path: "/services/prometheus",
	},
	{
		serviceType: "backups",
		label: "Backups",
		icon: DatabaseBackup,
		path: "/services/backups",
	},
	{
		serviceType: "authentik",
		label: "Authentik",
		icon: Users,
		path: "/services/authentik",
	},
];

/**
 * Filter the static entries to those whose service type is configured (present
 * in the `configuredTypes` set). Returns a flat list in declaration order.
 */
export function configuredNavEntries(configuredTypes: Set<string>): NavEntry[] {
	return SERVICE_TYPE_NAV_ENTRIES.filter((e) =>
		configuredTypes.has(e.serviceType),
	);
}
