//
//  OffcnIMSocketManager.h
//  OffcnIMSDKiOS
//
//  Created by vockey on 2020/8/24.
//  Copyright © 2020 offcn. All rights reserved.
//

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

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, OffcnIMConnectStatus) {
    OffcnIMConnectStatusSuccess = 0,        //连接成功
    OffcnIMConnectStatusFail = 1,           //连接失败
    OffcnIMConnectStatusBreak = 2,          //连接断开
    OffcnIMConnectStatusDisConnectOK = 3,   //手动断开成功
    OffcnIMConnectStatusOverLimit = 3001,        //连接数量超过限制
    OffcnIMConnectStatusUserNoExist = 5002,        //用户不存在
    OffcnIMConnectStatusTokenInvalid = 5003,        //token已失效
    OffcnIMConnectStatusKickout = 8003,        //账号被踢
};

//收到消息回调
typedef void(^OffcnIMConnectReceiveMessage)(OffcnIMModel *IMModel);

//连接状态回调
typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString *errorMessage);

@interface OffcnIMSocketManager : NSObject

@property (nonatomic, copy) NSString *msg_fromId;//发送消息的用户id
@property (nonatomic, copy) NSString *token;//发送消息的用户token


@property (nonatomic, assign) OffcnIMConnectStatus IMConnectStatus;//连接状态

//收到消息回调
@property (nonatomic, copy) OffcnIMConnectReceiveMessage connectReceiveMessage;

//连接状态回调
@property (nonatomic, copy) OffcnIMReceiveConnectStatus connectStatus;

//单例
+(OffcnIMSocketManager *)defaultService;

/// 建立连接
/// @param account_id 用户ID
/// @param token 用户token
-(void)connectIMServerWithAccount_id:(NSString *)account_id token:(NSString *)token;

//断开连接
-(void)disConnectIMServer;

//后台收到消息本地推送
-(void)manualSendLocalNotificationWithModel:(OffcnIMModel *)model;
@end

NS_ASSUME_NONNULL_END
