//
//  ChatsStore.h
//  AIIM
//
//  Created by gan on 2025/4/1.
//

#ifndef ChatsStore_h
#define ChatsStore_h


#endif /* ChatsStore_h */
#import "GIMobj.h"

@protocol ChatsStoreDelegate <NSObject>
@optional
- (void)ChatsChange:(NSArray *_Nullable)msgList type:(NSInteger)typpe;
@end


@interface ChatsStore : NSObject

+ (ChatsStore *_Nonnull)shareInstance;
@property (nonatomic,weak) id <ChatsStoreDelegate> delegate;

@property (nonatomic) NSInteger reloadC;
@property (nonatomic,strong) NSMutableArray * _Nullable msgList;
@property (nonatomic,strong) NSString * _Nullable chatId;
@property (nonatomic) NSInteger lastreadTime;
@property (nonatomic,strong) NSString * _Nullable userid;

@property (nonatomic,strong) NSArray * _Nullable groupUserList;


-(void)reciveMsg:(NSDictionary *_Nonnull)msg;

-(void)deleteMineTmpMsg:(NSDictionary *_Nonnull)msg;
//第一次打开，连带请求所有离线消息
-(void)getGroupUserList:(NSString *_Nonnull)chatId;//获取群成员信息
-(void)reloadData:(NSString *_Nonnull)chatId type:(NSInteger)type;//单聊
-(void)reloadQunData:(NSString *_Nonnull)chatId type:(NSInteger)type;//群聊
-(void)reloadData:(NSString *_Nonnull)chatId;

//更新最后已读时间
-(void)updatereadTime:(NSDictionary *_Nullable)dis;
-(NSDictionary *_Nullable)getchatReadTime:(NSString *_Nullable)chatId;

-(void)loadNextData:(NSString *_Nullable)chatId timestp:(NSInteger)timestp;
-(void)loadQunNextData:(NSString *_Nullable)chatId timestp:(NSInteger)timestp;

//获取群组历史记录 先获取群成员列表
-(void)getGroupHistory:(NSString *_Nonnull)groupId type:(NSString *_Nullable)type;

//按消息分类查询本消息
-(void)reloadDataWithType:(NSString *_Nonnull)chatId type:(NSString *_Nullable)type;
-(void)loadNextDataAll:(NSString *_Nonnull)chatId timestp:(NSInteger)timestp;
//安消息分类查询本地消息下一页
-(void)loadNextDataWithType:(NSString *_Nonnull)chatId type:(NSString *_Nullable)type timestp:(NSInteger)timestp;

//字典型数组排序
-(NSArray *_Nullable)arraysort:(NSArray *_Nullable)array;
//替换指定数据
-(NSArray *_Nullable)replaydisData:(NSDictionary *_Nullable)dis inarray:(NSArray *_Nullable)array;

//消息列表中执行删除操作
-(void)deleteMyLocalMsg:(NSDictionary *_Nonnull)msg;

@end
