"use strict";

export const createRoomFromApi = (room, service = 'conference.dev.xmpp.ethoradev.com', usersArrayLength = 0) => {
  try {
    const roomData = {
      ...room,
      id: room?._id || '',
      jid: `${room?.name}@${service}` || '',
      name: room?.title || '',
      title: room?.title || '',
      usersCnt: Number(room?.members?.length || usersArrayLength + 1),
      messages: [],
      isLoading: false,
      roomBg: null,
      icon: room?.picture !== 'none' ? room?.picture : null,
      unreadMessages: 0,
      lastViewedTimestamp: 0
    };
    return roomData;
  } catch (error) {
    console.log(error);
    return null;
  }
};
//# sourceMappingURL=createRoomFromApi.js.map