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;
        translate?: {
            text?: string;
            items?: ResponseItemV2;
        };
    };
    deleteFlag?: number;
    at?: number;
}
declare type UpdateTag = {
    reSend?: boolean;
};
export declare enum EventType {
    MessageChangeEvent = "Message_Change"
}
export declare const DeleteFlag: {
    Deleted: number;
};
declare class MessageEntity {
    private db?;
    private userId?;
    private store?;
    Event: {
        MessageChangeEvent: string;
    };
    static authorize: boolean;
    init(db: Dexie): void;
    getAllUnReadMsgById(conversationId?: string): Promise<number>;
    getAllUnread(): Promise<number | undefined>;
    getMessagesByMids(mids: string[]): 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[]>;
    getLastMessageOfSession(chatId: string): Promise<Message<string> | undefined>;
    getAllMessageByChatId(chatId: string): Promise<Message<string>[] | undefined>;
    getAllMySendMessagesByChatId(chatId: string): Promise<string[]>;
    getAllRevokeMidsByChatId(chatId: string, operator: string): Promise<string[]>;
    loadMessage(conversationId?: string, count?: number, formIndex?: number, offset?: number): Promise<Message[]>;
    getSequence(offset?: number): Promise<number>;
    getMaxSequenceByChatId(chatId: string): Promise<number>;
    getMaxSequenceByChatIdWithUserMessage(chatId: string): Promise<number>;
    getUserId(): string | undefined;
    insertItem(item: Message): Promise<void>;
    bulkAddItems(items: Message[]): Promise<void>;
    insertBulkItems(items: Message[]): Promise<void>;
    updateItem(item: Message, options?: UpdateTag): Promise<void>;
    /**
     * todo: 操作数据量可能较大，这里暂时不发通知，业务层清空消息列表
     */
    bulkDeleteItemByMids(mids: string[], changes: Partial<Message>): Promise<number | undefined>;
    modifyItemByMid(mid: string, changes: Partial<Message>): Promise<number | undefined>;
    modifyItemBy(index: string, value: any, changes: Partial<Message>): Promise<number | undefined>;
    markSingleSessionAsRead(messages: Message[], sessionId: string, force?: boolean): Promise<void>;
    setMessageDeleteFlag(ids: string[]): 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(): Promise<void>;
    deleteItemInertNewPosition(msg: Message<any>): void;
    handlePublish(messages: Message[], syncSession?: boolean): Promise<void>;
    handleSyncSessionUnread(messages: any): Promise<void>;
}
export declare const isUserMessage: (message: Message) => boolean;
export declare const filterNeedAckMessage: (item: Message) => boolean;
declare const self: MessageEntity;
export default self;
