"use strict";
const utils = require("./utils-3L7vCF_z.cjs");
const index = require("./index-QSf6WJj0.cjs");
const indexBrowser = require("./index-browser-RtwB1hqI.cjs");
const processEventTypes = (eventTypes) => {
  const eventTypesWithLogo = eventTypes.map((eventType) => {
    const locationParsed = indexBrowser.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;
