//
//  OffcnIMSDKiOS.h
//  OffcnIMSDKiOS
//
//  Created by vockey on 2018/10/16.
//  Copyright © 2018年 中公教育. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "OffcnIMModel.h"

static const NSString *OffcnIMSDKiOSVersion = @"1.0.0.0";

typedef NS_ENUM(NSUInteger, OffcnSDKReachabilityStatus) {
    OffcnSDKReachabilityStatusNotReachable = 0,
    OffcnSDKReachabilityStatusViaWWAN,
    OffcnSDKReachabilityStatusViaWiFi,
};

typedef NS_ENUM(NSUInteger, OffcnSDKMsgType) {
    OffcnSDKMsgTypeText = 1, //文本消息
    OffcnSDKMsgTypePicture,  //图片消息
    OffcnSDKMsgTypeAudio,    //音频消息
    OffcnSDKMsgTypeVideo,    //视频消息
    OffcnSDKMsgTypeFile,     //文件消息
};

typedef NS_ENUM(NSUInteger, OffcnSDKMsgScope) {
    OffcnSDKMsgScopeSingleChat = 1, //单聊消息
    OffcnSDKMsgScopeGroupChat,      //群聊消息
};

typedef NS_ENUM(NSUInteger, OffcnSDKType) {
    OffcnSDKTypeIM = 1, //IM 消息
};

//网络监听回调
typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus status);

@interface OffcnIMSDKiOS : NSObject

//返回单例对象
+ (OffcnIMSDKiOS *)defaultService;

//是否选用测试环境
@property (nonatomic, assign) BOOL isTest;

//deviceToken
@property (nonatomic, copy) NSString *deviceToken;


@property (nonatomic, assign) OffcnSDKReachabilityStatus OffcnReachabilityStatus;
@property (nonatomic, copy) OffcnSDKReachabilityStatusCallBack reachabilityStatusCallBack;

//监听网络状态
-(void)startNotifierUseRealReachability;


/// 发送消息
/// @param msg_fromID 发送人ID
/// @param msg_toID 接收人ID
/// @param msg_type 发送消息类型
/// @param text 文本
/// @param filePath 图片/音频（语音消息格式，只能是aac格式）/视频/文件，沙盒路径
/// @param finished 结果回调
-(void)sendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_type:(OffcnSDKMsgType)msg_type text:(NSString *)text filePath:(NSString *)filePath Finished:(void(^)(BOOL success,OffcnIMSendMsgModel *sendMsgModel,NSString *errorMessage))finished ProgressPercent:(void(^)(NSString *key, float percent))progressPercent;

/// 用户信息标记已读
/// @param msg_fromID 发送人ID
/// @param msg_toID 接收人ID
/// @param msg_seq 消息时序
/// @param finished 结果回调
-(void)markMsgReadWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_seq:(NSInteger)msg_seq Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;

/// 获取会话未读消息列表
/// @param fromID 发送人ID
/// @param toID 接收人ID
/// @param finished 结果回调
-(void)getSessionUnreadMsgWithFromID:(NSString *)fromID toID:(NSString *)toID Finished:(void(^)(BOOL success,OffcnIMUnreadMsgModel *unreadMsgModel,NSString *errorMessage))finished;

/// 获取用户最近会话记录
/// @param accid 被获取用户id
/// @param finished 结果回调
-(void)getRecentSessionsWithAccid:(NSString *)accid Finished:(void(^)(BOOL success,OffcnIMRecentMsgModel *recentMsgModel,NSString *errorMessage))finished;

/// 获取会话历史消息列表
/// @param fromID 发送人ID
/// @param toID 接收人ID
/// @param msg_seq 消息时序
/// @param finished 结果回调
-(void)getSessionHistoryMsgWithFromID:(NSString *)fromID toID:(NSString *)toID msg_seq:(NSString *)msg_seq Finished:(void(^)(BOOL success,OffcnIMHistoryMsgModel *historyMsgModel,NSString *errorMessage))finished;

/// 注册用户设备
/// @param accid 用户ID
/// @param device_token 设备Token
/// @param finished 结果回调
-(void)registerDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;

/// 注销用户设备
/// @param accid 用户ID
/// @param device_token 设备Token
/// @param finished 结果回调
-(void)unregisterDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;
@end

//所有接口code 1000处理：重连
