import { NavOptions } from "../navigation/navigationtabs";

export const hasAccess = (
  item: NavOptions,
  userPermissions: string[],
  userRoles: string[]
): boolean => {
  const permsCheck =
    item.perms?.some((perm) => userPermissions.includes(perm)) ?? true;

  const rolesCheck =
    item.roles?.some((role) => userRoles.includes(role)) ?? true;

  return permsCheck || rolesCheck;
};
