"use client";
import { useEffect } from "react";
import { useRouter } from "next/navigation";

export default () => {
	const router = useRouter();

	useEffect(() => {
		// Replace this with actual permission-checking logic
		const hasDispoPermission = checkUserPermission("DISPO");

		if (hasDispoPermission) {
			router.replace("/dispatch");
		} else {
			router.replace("/pilot");
		}
	}, [router]);

	return null;

	// Mock function for permission checking
	function checkUserPermission(permission: string): boolean {
		// Replace with real permission logic
		return permission === "DISPO";
	}
};
