"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const uuid = require("uuid");
const getAppKeysFromSlug = require("./getAppKeysFromSlug-tS_OdWJj.cjs");
const CalEventParser = require("./CalEventParser-RR7nWuhu.cjs");
const JitsiVideoApiAdapter = () => {
  return {
    getAvailability: () => {
      return Promise.resolve([]);
    },
    createMeeting: async (eventData) => {
      const appKeys = await getAppKeysFromSlug.getAppKeysFromSlug(CalEventParser.metadata.slug);
      const meetingPattern = appKeys.jitsiPathPattern || "{uuid}";
      const hostUrl = appKeys.jitsiHost || "https://meet.jit.si/cal";
      const meetingID = meetingPattern.replaceAll("{uuid}", uuid.v4()).replaceAll("{Title}", eventData.title).replaceAll("{Event Type Title}", eventData.type).replaceAll("{Scheduler}", eventData.attendees.map((a) => a.name).join("-")).replaceAll("{Organizer}", eventData.organizer.name).replaceAll("{Location}", eventData.location || "").replaceAll("{Team}", eventData.team?.name || "").replaceAll(" ", "-");
      return Promise.resolve({
        type: CalEventParser.metadata.type,
        id: meetingID,
        password: "",
        url: `${hostUrl}/${encodeURIComponent(meetingID)}`
      });
    },
    deleteMeeting: async () => {
      Promise.resolve();
    },
    updateMeeting: (bookingRef) => {
      return Promise.resolve({
        type: "jitsi_video",
        id: bookingRef.meetingId,
        password: bookingRef.meetingPassword,
        url: bookingRef.meetingUrl
      });
    }
  };
};
exports.default = JitsiVideoApiAdapter;
