// type Feature = string;
// interface Module {
//     id: number;
//     name: string;
//     features: Feature[];
//     active: boolean;
// }

import { useModuleStore } from "../-lib/store/useModuleStore";

// const modules: Module[] = [
//     {id: 1, name: "production", active: true, features: ["view", "edit", "approve"]},
//     {id: 2, name: "logistics", active: true, features: ["view", "assign", "track"]},
//     {id: 3, name: "quality", active: false, features: ["view", "audit", "approve"]},
//     {id: 4, name: "forklift", active: true, features: ["view", "request", "operate"]},
//     {id: 5, name: "admin", active: true, features: ["view", "manage_users", "view_logs", "settings"]},
// ];

export function moduleActive(moduleName: string): boolean {
	const { modules } = useModuleStore();
	const module = modules?.find(
		(m: any) => m.name === moduleName && m.active === true,
	);
	return module ? true : false;
}
