import { usePage } from "@inertiajs/vue3";
//#region resources/js/Composables/useAuth.ts
function useAuth() {
	const page = usePage();
	const user = () => page.props.auth?.user;
	const settings = () => page.props.settings;
	const hasRole = (role) => {
		const currentUser = user();
		if (!currentUser) return false;
		if (currentUser.roles.includes("Super Admin")) return true;
		return currentUser.roles.includes(role);
	};
	const hasPermission = (permission) => {
		const currentUser = user();
		if (!currentUser) return false;
		if (currentUser.roles.includes("Super Admin")) return true;
		return currentUser.permissions.includes(permission);
	};
	return {
		user,
		settings,
		hasRole,
		hasPermission
	};
}
//#endregion
export { useAuth as t };
