import Dexie from "dexie";
import { Spread } from "../service/api/PullMessage";
import { ResponseItemV2 } from "../service/api/message/translate";
export interface Message<T = string> {
    id?: number;
    amid: string;
    mid: string;
    sequence?: number;
    chatId: string;
    aChatId: string;
    sender: string;
    type: number;
    status: number;
    content: T;
    timestamp: number;
    displayTime?: number;
    sendTime?: number;
    extra?: {
        mids?: string[];
    };
    local?: {
        notFriends?: boolean;
        sessionLastActionTime?: number;
        path?: string;
        uploadFinished?: boolean;
        translate?: {
            text?: string;
            items?: ResponseItemV2;
        };
    };
    deleteFlag?: number;
    at?: number;
}
type UpdateTag = {
    reSend?: boolean;
    syncSession?: boolean;
    publish?: boolean;
};
export declare enum EventType {
    MessageChangeEvent = "Message_Change",
    MessageRecallEvent = "Message_Recall"
}
export declare const DeleteFlag: {
    Deleted: number;
};
declare class MessageEntity {
    private db?;
    private userId?;
    private store?;
    static authorize: boolean;
    init(db: Dexie): void;
    getSeq(start: number, end: number): Promise<Message<string>[] | undefined>;
    findMessagesByUids(uids: string[], userId: string): Promise<{
        [key: string]: {
            peer?: Message<string> | undefined;
            me?: Message<string> | undefined;
        };
    }>;
    getAllUnReadMsgById(conversationId?: string): Promise<number>;
    getAllUnReadById(conversationId?: string): Promise<Message<string>[] | undefined>;
    getUnReadMsgById(conversationId?: string): Promise<Message<string>[] | undefined>;
    getAllUnread(): Promise<number | undefined>;
    getMessagesByMids(mids: string[]): Promise<Message[]>;
    getMessagesBySeqs(seqs: number[]): Promise<Message[]>;
    getMessageByPrimaryId(ids: number[]): Promise<Message[]>;
    getMessageBySequence(seq: number): Promise<Message | undefined>;
    getUnExistMsg(mids: Spread[]): Promise<Spread[]>;
    getMessageByMid(mid: string): Promise<Message | undefined>;
    getMessageByAmid(amid: string): Promise<Message | undefined>;
    getImageMessagesOfSession(chatId: string): Promise<Message[]>;
    getWaitSendMessage(): Promise<Message[]>;
    getWaitSendMessageByChatId(chatId: string): Promise<string[]>;
    getMessagesAfterPrimaryKeyInSession(id: number, chatId: string): Promise<Message[]>;
    getMessageAt(chatId: string): Promise<Message[]>;
    getFirstMessageOfSession(chatId: string): Promise<Message<string> | undefined>;
    getLastMessageOfSession(chatId: string, extraFilter?: (msg: Message) => boolean): Promise<Message<string> | undefined>;
    getAllMessageByChatId(chatId: string): Promise<Message<string>[] | undefined>;
    getAllMySendMessagesByChatId(chatId: string): Promise<string[]>;
    getAllRevokeMidsByChatId(chatId: string, operator: string, sequence?: number): Promise<string[]>;
    loadMessage(conversationId?: string, count?: number, formIndex?: number, offset?: number): Promise<Message[]>;
    loadSearchMessage(conversationId?: string, count?: number, formIndex?: number, offset?: number, sequence?: number): Promise<Message[]>;
    getSequence(offset?: number): Promise<number>;
    getMaxSequence(): Promise<number>;
    getMaxSequenceByChatId(chatId: string): Promise<number>;
    getMessagesAfterSequence(chatId: string, sequence: number): import("dexie").PromiseExtended<Message<string>[]>;
    getMaxSequenceByChatIdWithUserMessage(chatId: string): Promise<number>;
    getUserId(): string | undefined;
    insertItem(item: Message): Promise<void>;
    bulkAddItems(items: Message[]): Promise<void>;
    insertBulkItems(items: Message[]): Promise<Message[]>;
    updateItem(item: Message, options?: UpdateTag): Promise<void>;
    bulkDeleteItemByMids(mids: string[], changes: Partial<Message>): Promise<number | undefined>;
    bulkDeleteByChatIds(chatIds: string[]): Promise<number | undefined>;
    modifyItemByMid(mid: string, changes: Partial<Message>): Promise<number | undefined>;
    bulkSetRead(mids: string[]): Promise<void>;
    modifyItemBy(index: string, value: any, changes: Partial<Message>): Promise<number | undefined>;
    markSingleSessionAsRead(messages: Message[], sessionId: string, force?: boolean): Promise<void>;
    setMessageDeleteFlag(ids: string[], deleteFlag?: number): Promise<void>;
    setMessageRevokeFlag(chat_id: string, needId: {}): Promise<void>;
    updateAckRead(ids: string[]): Promise<void>;
    updateTranslateV2({ mid, items }: {
        mid: string;
        items: ResponseItemV2;
    }): Promise<void>;
    updateTranslate({ mid, text }: {
        mid: string;
        text: string;
    }): Promise<void>;
    deleteItemByPrimaryKey(id: number): Promise<void>;
    refreshMessageStatus(data: StatusData): Promise<void>;
    deleteItemInertNewPosition(msg: Message<any>): void;
    handlePublish(messages: Message[], syncSession?: boolean): Promise<void>;
    handleSyncSessionUnread(messages: any): Promise<void>;
    getHasUnreadMessageCompatible(): Promise<Record<string, Message[]> | undefined>;
}
export declare const isUserMessage: (message: Message) => boolean;
export declare const filterNeedAckMessage: (item: Message, includeNotificationAgent?: boolean) => boolean;
declare const self: MessageEntity;
export default self;
export interface StatusData {
    create_time: number;
    update_time: number;
    offline: any;
    sequence: number;
    type: number;
    chat_id: string;
    extra: string;
    content: string;
    status: number;
    send_time: number;
    id: string;
    amid: string;
    sender_id: string;
}
