import { CometChat } from '@cometchat-pro/react-native-chat';
import { CALL_BUSY, CALL_CANCELLED, CALL_ENDED, CALL_INITIATED, CALL_ONGOING, CALL_REJECTED, CALL_UNANSWERED, } from '../shared/constants/UIKitConstants';
import { localize } from '../shared/resources/CometChatLocalize';
export class CallUtils {
    static isInitiator(initiator, loggedInUser) {
        return initiator.getUid() == loggedInUser.getUid();
    }
    static getCallStatus(message, loggedInUser) {
        if (!(message instanceof CometChat.Call))
            return '';
        let call = message;
        let callMessageText = '';
        let initiator = call.getCallInitiator();
        switch (call.getStatus()) {
            case CALL_INITIATED:
                if (this.isInitiator(initiator, loggedInUser)) {
                    callMessageText = `${localize('OUTGOING_CALL')}`;
                }
                else {
                    callMessageText = `${localize('INCOMING_CALL')}`;
                }
                break;
            case CALL_ONGOING:
                callMessageText = `${localize('CALL_ACCEPTED')}`;
                break;
            case CALL_ENDED:
                callMessageText = `${localize('CALL_ENDED')}`;
                break;
            case CALL_UNANSWERED:
                if (this.isInitiator(initiator, loggedInUser)) {
                    callMessageText = `${localize('CALL_UNANSWERED')}`;
                }
                else {
                    callMessageText = `${localize('CALL_MISSED')}`;
                }
                break;
            case CALL_CANCELLED:
                if (this.isInitiator(initiator, loggedInUser)) {
                    callMessageText = `${localize('CALL_CANCELLED')}`;
                }
                else {
                    callMessageText = `${localize('CALL_MISSED')}`;
                }
                break;
            case CALL_REJECTED:
            case CALL_BUSY:
                if (this.isInitiator(initiator, loggedInUser)) {
                    callMessageText = `${localize('CALL_REJECTED')}`;
                }
                else {
                    callMessageText = `${localize('CALL_MISSED')}`;
                }
                break;
        }
        if (callMessageText == undefined || callMessageText == "undefined")
            console.log(message, loggedInUser);
        return callMessageText;
    }
}
//# sourceMappingURL=CallUtils.js.map