import { localize } from "../resources/CometChatLocalize";
import { CometChat } from "@cometchat/chat-sdk-react-native";
import { MessageTypeConstants } from "../constants/UIKitConstants";
export class CometChatConversationUtils {
    static getDefaultOptions() {
        let options = [];
        options.push({
            id: "1",
            title: localize("DELETE"),
            backgroundColor: "rgb(255, 59, 48)",
        });
        return options;
    }
    static getLastMessage(conversation) {
        let msg = conversation?.getLastMessage && conversation?.getLastMessage();
        if (!msg) {
            return undefined;
        }
        switch (msg['category']) {
            case "message":
                break;
            case "custom":
                break;
            case "action":
                break;
            case "call":
                break;
            default:
                break;
        }
        return msg;
    }
    static getMessagePreview = (lastMessage) => {
        if (lastMessage != undefined) {
            if (lastMessage.getDeletedAt() !== undefined) {
                return localize("THIS_MESSAGE_DELETED");
            }
            let groupText = "", msgText = "";
            if (lastMessage.getCategory() == 'message') {
                switch (lastMessage.getType()) {
                    case "text":
                        msgText = lastMessage.getText();
                        break;
                    case 'image':
                        msgText = localize('MESSAGE_IMAGE');
                        break;
                    case 'audio':
                        msgText = localize('MESSAGE_AUDIO');
                        break;
                    case 'video':
                        msgText = localize('VIDEOS');
                        break;
                    case 'file':
                        msgText = localize('MESSAGE_FILE');
                        break;
                }
            }
            else if (lastMessage.getCategory() == CometChat.CATEGORY_CUSTOM) {
                msgText = lastMessage.getType();
            }
            else if (lastMessage.getCategory() == CometChat.CATEGORY_ACTION) {
                if (lastMessage?.getAction() === CometChat.ACTION_TYPE.MESSSAGE_DELETED) {
                    return localize("THIS_MESSAGE_DELETED");
                }
                msgText = lastMessage.getMessage();
            }
            else if (lastMessage.getCategory() === CometChat.CATEGORY_INTERACTIVE) {
                msgText = lastMessage.getType() === "form"
                    ? `${localize('FORM')} 📋`
                    : lastMessage.getType() === MessageTypeConstants.scheduler
                        ? (lastMessage?.interactiveData?.title ?
                            `🗓️ ${lastMessage?.interactiveData?.title}`
                            : `🗓️ ${localize('MEET_WITH')} ${lastMessage?.getSender()?.getName()}`)
                        : `${localize('CARD')} 🪧`;
            }
            else {
                msgText = lastMessage['metaData']?.pushNotification;
            }
            return (msgText);
        }
        else {
            return "";
        }
    };
}
//# sourceMappingURL=conversationUtils.js.map