"use strict";
const utils = require("./utils-U8_Jj24h.cjs");
const index = require("./user-v6mfWQ2d.cjs");
const processEventTypes = (eventTypes) => {
  const eventTypesWithLogo = eventTypes.map((eventType) => {
    const locationParsed = index.eventTypeLocations.safeParse(eventType.locations);
    const app = utils.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 index.prisma.eventType.findMany({
    where: {
      userId,
      teamId: null
    },
    select: {
      id: true,
      title: true,
      locations: true
    }
  });
  return processEventTypes(eventTypes);
};
const getBulkTeamEventTypes = async (teamId) => {
  const eventTypes = await index.prisma.eventType.findMany({
    where: {
      userId: null,
      teamId
    },
    select: {
      id: true,
      title: true,
      locations: true
    }
  });
  return processEventTypes(eventTypes);
};
exports.getBulkTeamEventTypes = getBulkTeamEventTypes;
exports.getBulkUserEventTypes = getBulkUserEventTypes;
