//
//  NXCallInfo.h
//  NXKit
//
//  Created by 徐家骏 on 2019/7/2.
//  Copyright © 2019 徐家骏. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(uint16_t, NXParticipantState)
{
    NXParticipantStateIdle     = 0,
    NXParticipantStateCalling  = 1,
    NXParticipantStateCalled   = 2,
    NXParticipantStateIncall   = 4,
};

typedef NS_ENUM(uint16_t, NXParticipantEvent)
{
    NXParticipantEventInvite     = 1,
    NXParticipantEventRecvInvite = 2,
    NXParticipantEventCancel     = 3,
    NXParticipantEventRecvCancel = 4,
    NXParticipantEventAccept     = 5,
    NXParticipantEventRecvAccept = 6,
    NXParticipantEventReject     = 7,
    NXParticipantEventRecvReject = 8,
    NXParticipantEventBusy       = 9,
    NXParticipantEventRecvBusy   = 10,
    NXParticipantEventEnd        = 11,
    NXParticipantEventRecvEnd    = 12,
    NXParticipantEventTimout     = 13,
    NXParticipantEventRing       = 14,
};

@interface NXCallInfo : NSObject

@property(nonatomic)   NXCallMode      mode;
@property(nonatomic)   int64_t          session_id;
@property(nonatomic)   int64_t          me;
@property(nonatomic)   int64_t          peer;
@property(nonatomic)   int64_t          opsrc; //通话触发者
@property(nonatomic)   int              net;
@property(nonatomic)   NXCallMediaType mediaType;
@property(nonatomic)   NXCallPreset    subType;
@property(nonatomic, strong) NSArray   *callees;
@property(nonatomic, strong) NSArray   *relays;
@property(nonatomic, strong) NSArray   *pubkeys;
@property(nonatomic, strong) NSDictionary *participantInfo;  //多方时的成员信息
@property(nonatomic)   int64_t          lastChangeTime; ///多方时的状态变化时间
@property(nonatomic)   int64_t          lastRelayChangeTime; //Relay列表有更改时的时间戳，客户端每次报告relay performance的时候带上此时间戳，服务器发现上次更改客户端还没收到的话，就需要重发relay更新信令

@property(nonatomic) NSString *msg; //外部携带的消息数据

- (void)clear;

- (NSOrderedSet *)activeParticipants;
- (NSOrderedSet *)newJoin;
- (NSOrderedSet *)newLeave;

@end

NS_ASSUME_NONNULL_END
