import { a as getAppFromLocationValue } from "./utils-tiDyn4ot.js";
import { p as prisma } from "./index-Cw1zbw54.js";
import { b as eventTypeLocations } from "./index-browser-c8sQ7p7S.js";
const processEventTypes = (eventTypes) => {
  const eventTypesWithLogo = eventTypes.map((eventType) => {
    const locationParsed = eventTypeLocations.safeParse(eventType.locations);
    const app = getAppFromLocationValue(
      locationParsed.success && locationParsed.data?.[0]?.type ? locationParsed.data[0].type : "integrations:daily"
    );
    return {
      ...eventType,
      logo: app?.logo
    };
  });
  return {
    eventTypes: eventTypesWithLogo
  };
};
const getBulkUserEventTypes = async (userId) => {
  const eventTypes = await prisma.eventType.findMany({
    where: {
      userId,
      teamId: null
    },
    select: {
      id: true,
      title: true,
      locations: true
    }
  });
  return processEventTypes(eventTypes);
};
const getBulkTeamEventTypes = async (teamId) => {
  const eventTypes = await prisma.eventType.findMany({
    where: {
      userId: null,
      teamId
    },
    select: {
      id: true,
      title: true,
      locations: true
    }
  });
  return processEventTypes(eventTypes);
};
export {
  getBulkTeamEventTypes as a,
  getBulkUserEventTypes as g
};
