"use strict";
const index = require("./user-v6mfWQ2d.cjs");
const credential = require("./credential-Uug66ge2.cjs");
function checkAdminOrOwner(role) {
  return role === "OWNER" || role === "ADMIN";
}
async function getUsersCredentialsIncludeServiceAccountKey(user) {
  const credentials = await index.prisma.credential.findMany({
    where: {
      userId: user.id
    },
    select: index.credentialForCalendarServiceSelect,
    orderBy: {
      id: "asc"
    }
  });
  const { credentials: allCredentials } = await credential.enrichUserWithDelegationCredentialsIncludeServiceAccountKey({
    user: {
      email: user.email,
      id: user.id,
      credentials
    }
  });
  return allCredentials;
}
exports.checkAdminOrOwner = checkAdminOrOwner;
exports.getUsersCredentialsIncludeServiceAccountKey = getUsersCredentialsIncludeServiceAccountKey;
