import { a as getAppFromLocationValue } from "./utils-xu1OORoz.js";
import { p as prisma, k as eventTypeLocations } from "./user--mpkKOwW.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
};
