//
//  OffcnIMZYJFMDBHandler.h
//  OffcnIMSDKiOS
//
//  Created by vockey on 2019/4/9.
//  Copyright © 2019年 中公教育. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, UIClearStyle) {
    UIClearStyleAll     = 1,//删除list和具体聊天内容
    UIClearStylePart    = 2,//只删除聊天内容 , list记录不删除
    UIClearStyleList    = 3 //删除系统消息等
};

@class OffcnIMBodyModel;
typedef void (^getFMDBHistoryMessagesBlock)(NSArray<OffcnIMBodyModel *> *messagesArray);
typedef void (^callBackIsSuccess)(BOOL isSuccess);


@interface OffcnIMZYJFMDBHandler : NSObject

+ (OffcnIMZYJFMDBHandler *)sharedInstance;
//获取用户相关数据库，该方法在登陆或者第一次启动已登陆下执行
- (void)getUserDB;
//发送,收到消息写入
- (void)insertChatInfoToFMDBWithModel:(OffcnIMBodyModel *)chatModel;
//消息发送成功更新状态
- (void)updateChatInfoIsSendStatusToFMDBWithModel:(OffcnIMBodyModel *)messageModel isSuccess:(callBackIsSuccess)isSuccess;
//自己发送消息更新聊天列表
- (void)chatlistCacheInfo:(OffcnIMBodyModel *)chatlistModel callback:(callBackIsSuccess)isSucess;
//某一条消息更新已读状态
- (void)updateChatInfoIsRead:(OffcnIMBodyModel *)model callBack:(callBackIsSuccess)isSuccess;
//删除个人聊天记录
- (void)deleteUserChatDataWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser clearStyle:(UIClearStyle)clearStyle callBack:(callBackIsSuccess)callbackBool;
//删除消息,并更新消息列表最后一条消息
- (void)deleteMessage:(OffcnIMBodyModel *)messageModel dataSource:(NSMutableArray *)array callback:(callBackIsSuccess)isSuccess;
//删除表格
- (void)deleteDataTable;
//查询聊天记录(按时间戳倒叙排序)
- (void)getChatRecordArrayWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser limit:(NSString *)limit startIndex:(NSString *)startIndex callback:(getFMDBHistoryMessagesBlock)messagesBack;
//查询聊天列表
- (void)getChatListArrayCallback:(getFMDBHistoryMessagesBlock)messagesBack;
//消息内容
- (NSString *)lastMessage:(OffcnIMBodyModel *)messageModel;
@end

