import type { Access } from 'payload'

export const isAdmin =
  (): Access =>
  ({ req: { user } }) => {
    return user?.roles === 'admin'
  }

export const isAdminOrEmployee =
  (): Access =>
  ({ req: { user } }) => {
    if (!user) {
      return false
    }

    return user.roles === 'admin' || user.roles === 'employee'
  }
