import { UserAccessLevel } from "@/collections/Users";
import { Access } from "payload";

export const isTenantAdmin: Access = ({ req }): boolean => {
  return (req.user?.accessLevel || 0) >= UserAccessLevel.TENANT_ADMIN
}

export const isSuperAdmin: Access = ({ req }): boolean => {
  return (req.user?.accessLevel || 0) >= UserAccessLevel.SUPER_ADMIN
}

export const isFullAccess: Access = ({ req }): boolean => {
  return (req.user?.accessLevel || 0) === UserAccessLevel.FULL_ACCESS
}
