import { p as prisma, c as credentialForCalendarServiceSelect } from "./user--mpkKOwW.js";
import { e as enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "./credential-7rcNyyEv.js";
function checkAdminOrOwner(role) {
  return role === "OWNER" || role === "ADMIN";
}
async function getUsersCredentialsIncludeServiceAccountKey(user) {
  const credentials = await prisma.credential.findMany({
    where: {
      userId: user.id
    },
    select: credentialForCalendarServiceSelect,
    orderBy: {
      id: "asc"
    }
  });
  const { credentials: allCredentials } = await enrichUserWithDelegationCredentialsIncludeServiceAccountKey({
    user: {
      email: user.email,
      id: user.id,
      credentials
    }
  });
  return allCredentials;
}
export {
  checkAdminOrOwner as c,
  getUsersCredentialsIncludeServiceAccountKey as g
};
