import { Client } from '@xmpp/client';
import { MODAL_TYPES } from '../helpers/constants/MODAL_TYPES';
import { TranslationObject } from '../helpers/transformTranslatations';

export interface IUser extends Partial<User> {
    id: string;
    name?: string;
    userJID?: string | null;
    token?: string;
    refreshToken?: string;
}
export interface IMessage {
    id: string;
    user: IUser;
    date: Date | string;
    body: string;
    roomJid: string;
    key?: string;
    coinsInMessage?: string | number;
    numberOfReplies?: number[] | number;
    isSystemMessage?: string;
    isMediafile?: string;
    locationPreview?: string;
    mimetype?: string;
    location?: string;
    pending?: boolean;
    timestamp?: number;
    showInChannel?: string;
    activeMessage?: boolean;
    isReply?: boolean | string;
    isDeleted?: boolean;
    mainMessage?: string;
    reply?: IReply[];
    reaction?: Record<string, ReactionMessage>;
    fileName?: string;
    translations?: TranslationObject;
    langSource?: string;
    originalName?: string;
    size?: string;
    xmppId?: string;
    xmppFrom?: string;
}
export interface ReactionMessage {
    emoji: string[];
    data: Record<string, string>;
}
export interface IReply extends IMessage {
}
export interface IRoom {
    name: string;
    jid: string;
    title: string;
    usersCnt: number;
    messages: IMessage[];
    isLoading: boolean;
    roomBg: string;
    members?: RoomMember[];
    type?: 'public' | 'group' | 'private';
    creteadAt?: string;
    appId?: string;
    createdAt?: string;
    createdBy?: string;
    description?: string;
    isAppChat?: boolean;
    picture?: string;
    updatedAt?: string;
    __v?: number | string;
    _id?: string;
    id?: string;
    lastMessage?: LastMessage;
    lastMessageTimestamp?: number;
    lastRoomMessage?: RoomLastMessage;
    icon?: string;
    composing?: boolean;
    composingList?: string[];
    lastViewedTimestamp?: number;
    unreadMessages?: number;
    noMessages?: boolean;
    role?: string;
    messageStats?: {
        lastMessageTimestamp?: number;
        firstMessageTimestamp?: number;
    };
    historyComplete?: boolean;
}
export interface ApiRoom {
    name: string;
    type: 'public' | 'group' | 'private';
    title?: string;
    description?: string;
    picture?: string;
    members?: RoomMember[];
    createdBy?: string;
    appId?: any;
    _id?: string;
    isAppChat?: boolean;
    createdAt?: string;
    updatedAt?: string;
    __v?: string;
}
export interface PostRoom {
    title: string;
    uuid?: string;
    type: 'public' | 'group';
    description?: string;
    picture?: string;
    members?: string[];
}
export interface PostReportRoom {
    chatName: string;
    category: string;
    text?: string;
}
export interface PostAddRoomMember {
    chatName: string;
    members: string[];
}
export interface DeleteRoomMember {
    roomId: string;
    members: string[];
}
export interface IRoomCompressed extends Pick<IRoom, 'jid'> {
}
export interface RoomMember {
    firstName: string;
    lastName: string;
    xmppUsername: string;
    _id: string;
    ban_status?: string;
    jid?: string;
    name?: string;
    role?: string;
    last_active?: number;
}
export interface RoomLastMessage {
    name: string;
    body: string;
}
export interface UserType extends IMessage {
    id: any;
    user: any;
    timestamp: any;
    text: any;
}
export interface ConfigUser {
    email: string;
    password: string;
}
export interface User {
    walletAddress: string;
    description?: string;
    token: string;
    refreshToken: string;
    defaultWallet: {
        walletAddress: string;
    };
    _id: string;
    firstName: string;
    lastName: string;
    email?: string;
    profileImage?: string;
    emails?: [
        {
            loginType: string;
            email: string;
            verified: boolean;
            _id: string;
        }
    ];
    appId: string;
    username: string;
    xmppPassword: string;
    langSource?: Iso639_1Codes;
    homeScreen?: string;
    registrationChannelType?: string;
    updatedAt?: string;
    authMethod?: string;
    resetPasswordExpires?: string;
    resetPasswordToken?: string;
    xmppUsername?: string;
    roles?: string[];
    tags?: string[];
    __v?: number;
    isProfileOpen?: boolean;
    isAssetsOpen?: boolean;
    isAgreeWithTerms?: boolean;
    isSuperAdmin?: any;
}
export interface XmppState {
    client: any;
    loading: boolean;
}
export interface IConfig {
    disableHeader?: boolean;
    disableMedia?: boolean;
    colors?: {
        primary: string;
        secondary: string;
    };
    googleLogin?: {
        enabled: boolean;
        firebaseConfig: {
            apiKey: string;
            authDomain: string;
            projectId: string;
            storageBucket: string;
            messagingSenderId: string;
            appId: string;
        };
    };
    jwtLogin?: {
        token: string;
        enabled: boolean;
        handleBadlogin?: React.ReactElement;
    };
    userLogin?: {
        enabled: boolean;
        user: User | null;
    };
    customLogin?: {
        enabled: boolean;
        loginFunction: any;
    };
    baseUrl?: string;
    xmppSettings?: xmppSettingsInterface;
    disableRooms?: boolean;
    defaultLogin?: boolean;
    disableInteractions?: boolean;
    chatHeaderBurgerMenu?: boolean;
    forceSetRoom?: boolean;
    roomListStyles?: React.CSSProperties;
    chatRoomStyles?: React.CSSProperties;
    setRoomJidInPath?: boolean;
    disableRoomMenu?: boolean;
    defaultRooms?: ConfigRoom[];
    refreshTokens?: {
        enabled: boolean;
        refreshFunction?: any;
    };
    backgroundChat?: {
        color?: string;
        image?: any;
    };
    bubleMessage?: {
        backgroundMessageUser?: string;
        backgroundMessage?: string;
        colorUser?: string;
        color?: string;
        borderRadius?: number;
    };
    headerLogo?: any;
    headerMenu?: () => void;
    headerChatMenu?: () => void;
    customRooms?: {
        rooms: PartialRoomWithMandatoryKeys[];
        disableGetRooms?: boolean;
        singleRoom: boolean;
    };
    enableTranslates?: boolean;
    disableRoomConfig?: boolean;
    disableProfilesInteractions?: boolean;
    disableUserCount?: boolean;
    clearStoreBeforeInit?: boolean;
    disableSentLogic?: boolean;
    initBeforeLoad?: boolean;
    newArch?: boolean;
    logoutCallback?: () => Promise<void>;
    qrUrl?: string;
}
type PartialRoomWithMandatoryKeys = Partial<IRoom> & Pick<IRoom, 'jid' | 'title'>;
export interface xmppSettingsInterface {
    devServer: string;
    host: string;
    conference?: string;
}
interface ConfigRoom {
    jid: string;
    pinned: boolean;
    _id?: string;
}
export interface StorageUser {
    appId: string;
    company: any[];
    firstName: string;
    homeScreen: string;
    lastName: string;
    referrerId: string;
    refreshToken: string;
    token: string;
    walletAddress: string;
    xmppPassword: string;
    _id: string;
    isAgreeWithTerms?: boolean;
    isAllowedNewAppCreate?: boolean;
    isAssetsOpen?: boolean;
    isProfileOpen?: boolean;
}
export interface xmppSettingsInterface {
    devServer: string;
    host: string;
    conference?: string;
}
export interface MessageProps {
    message: IMessage;
    isUser: boolean;
    isReply: boolean;
}
export interface MediaMessageType {
}
export interface DeleteModal {
    isDeleteModal: boolean;
    roomJid?: string;
    messageId?: string;
}
export interface EditAction {
    isEdit: boolean;
    roomJid?: string;
    messageId?: string;
    text?: string;
}
export interface ReactionAction {
    roomJID: string;
    messageId: string;
    from: string;
    reactions: string[];
    latestReactionTimestamp?: string;
    data?: Record<string, string>;
}
export type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
export interface ModalFile {
    fileName: string;
    fileURL: string;
    mimetype: string;
}
export interface ReactionAction {
    roomJID: string;
    messageId: string;
    reactions: string[];
}
export interface AddRoomMessageAction {
    roomJID: string;
    message: IMessage;
    start?: boolean;
}
export interface XmppClientInterface {
    client: Client;
    devServer?: string;
    host: string;
    service: string;
    conference: string;
    username: string;
    status: string;
    password: string;
    reconnectAttempts: number;
    maxReconnectAttempts: number;
    reconnectDelay: number;
    checkOnline(): boolean;
    initializeClient(): void;
    attachEventListeners(): void;
    reconnect(): void;
    close(): Promise<void>;
    getRoomsStanza(): Promise<void>;
    createRoomStanza(title: string, description: string, to?: string): Promise<any>;
    inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
    leaveTheRoomStanza(roomJID: string): void;
    presenceInRoomStanza(roomJID: string): void;
    getHistoryStanza(chatJID: string, max: number, before?: number, otherStanzaId?: string): Promise<any>;
    getLastMessageArchiveStanza(roomJID: string): void;
    setRoomImageStanza(roomJid: string, roomThumbnail: string, type: string, roomBackground?: string): void;
    getRoomInfoStanza(roomJID: string): void;
    getRoomMembersStanza(roomJID: string): void;
    setVCardStanza(xmppUsername: string): void;
    sendMessage(roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string): void;
    sendMessageReactionStanza(messageId: string, roomJid: string, reactionsList: string[], data: any, reactionSymbol?: any): void;
    deleteMessageStanza(room: string, msgId: string): void;
    editMessageStanza(room: string, msgId: string, text: string): void;
    sendTypingRequestStanza(chatId: string, fullName: string, start: boolean): void;
    getChatsPrivateStoreRequestStanza(): Promise<any>;
    actionSetTimestampToPrivateStoreStanza(chatId: string, timestamp: number, chats?: string[]): Promise<void>;
    sendMediaMessageStanza(roomJID: string, data: any): void;
    createPrivateRoomStanza(title: string, description: string, to: string): Promise<string>;
    sendMessageReactionStanza(messageId: string, roomJid: string, reactionsList: string[], reactionSymbol?: any): void;
    getRoomsPagedStanza(maxResults: number, after: string | null): void;
    disconnect?(): void;
}
export type Iso639_1Codes = 'en' | 'es' | 'pt' | 'ht' | 'zh';
export interface Language {
    iso639_1: Iso639_1Codes;
    name: string;
}
export type LanguageOptions = {
    languages: Array<Language>;
    language?: Iso639_1Codes;
};
export type MediaFile = {
    uri: string;
    type: string;
    name: string;
};
export interface LastMessage extends Omit<Partial<IMessage>, 'date'> {
    body: string;
    date?: string | Date;
    emoji?: string;
    locationPreview?: string;
    filename?: string;
    mimetype?: string;
    originalName?: string;
}
export type ChatAccessOption = {
    name: 'Public';
    id: 'public';
} | {
    name: 'Members-only';
    id: 'group';
};
export {};
