//
//  NXGlobalDefs.h
//  NXKit
//
//  Created by 徐家骏 on 2017/6/12.
//  Copyright © 2017年 徐家骏. All rights reserved.
//

#ifndef NXGlobalDefs_h
#define NXGlobalDefs_h

typedef NS_ENUM(uint16_t, NXCallMode)
{
    NXCallModeOneToOne       = 1,
    NXCallModeMultiple       = 2,
};

typedef NS_ENUM(uint8_t, NXCallAudioPreferredMode)
{
    NXCallAudioPreferredModeNormal        = 1,
    NXCallAudioPreferredModeLowDelay      = 2,
    NXCallAudioPreferredModeQuality       = 3,
};

typedef NS_ENUM(uint8_t, NXCallVideoPreferredMode)
{
    NXCallVideoPreferredModeNormal       = 1,
    NXCallVideoPreferredModeFluency      = 2,
    NXCallVideoPreferredModeClear        = 3,
};

/**
 音频采样率
 */
typedef NS_ENUM(NSInteger, NXAudioSampleRate) {
    /**
     *  默认采样率
     */
    NXAudioSampleRateDefault             = 48000,

    NXAudioSampleRate8000HZ              = 8000,

    NXAudioSampleRate16000HZ             = 16000,

    NXAudioSampleRate24000HZ             = 24000,

    NXAudioSampleRate48000HZ             = 48000,
};

/**
 音频采样长度
 */
typedef NS_ENUM(NSInteger, NXAudioFrameMs) {
    /**
     *  默认采样率
     */
    NXAudioFrameMs5              = 5,
    
    NXAudioFrameMs10              = 10,
    
    NXAudioFrameMs20              = 20,
    
    NXAudioFrameMs40              = 40,
};



/**
 摄像头
 */
typedef NS_ENUM(NSInteger, NXVideoCameraPosition) {
    NXVideoCameraPositionUnspecified     = 0,
    NXVideoCameraPositionBack            = 1,
    NXVideoCameraPositionFront           = 2,
};


/**
 视频方向
 */
typedef NS_ENUM(NSInteger, NXVideoOrientation) {
    /**
     *  默认方向
     */
    NXVideoOrientationDefault             = 0,
    /**
     *  垂直方向, home 键朝下
     */
    NXVideoOrientationPortrait            = 1,
    /**
     *  垂直方向, home 键朝上
     */
    NXVideoOrientationPortraitUpsideDown  = 2,
    /**
     *  水平方向, home 键在右边
     */
    NXVideoOrientationLandscapeRight      = 3,
    /**
     *  水平方向, home 键在左边
     */
    NXVideoOrientationLandscapeLeft       = 4,
};

/**
 *  网络通话音视频质量
 */
typedef NS_ENUM(NSInteger, NXCallPreset) {
    NXCallPresetLost = 0,
    NXCallPreset240P = 1,
    NXCallPreset480P = 2,
    NXCallPreset720P = 3,
    NXCallPreset1080P = 4,
    NXCallPreset2K = 5,
    NXCallPreset4K = 6,
    NXCallPresetAudioDefault = 50,
    NXCallPresetPSTNDefault = 100,
};

typedef NS_ENUM(NSInteger, NXCallVideoPreset) {
    /**
     *  默认视频质量
     */
    NXCallVideoPresetDefault    = 0,
    /**
     *  低视频质量
     */
    NXCallVideoPresetLow        = 1,
    /**
     *  中等视频质量
     */
    NXCallVideoPresetMedium     = 2,
    /**
     *  高视频质量
     */
    NXCallVideoPresetHigh       = 3,
    /**
     *  480P等级视频质量
     */
    NXCallVideoPreset480p       = 4,
    /**
     *  720P等级视频质量
     */
    NXCallVideoPreset720p       = 5,
    NXCallVideoPreset1080p      = 6,
    NXCallVideoPreset4k         = 7,
};

/**
 *  画面裁剪
 */
typedef NS_ENUM(NSInteger, NXCallVideoCrop) {
    /**
     *  16:9 裁剪
     */
    NXCallVideoCrop16x9             = 0,
    /**
     *  4:3 裁剪
     */
    NXCallVideoCrop4x3              = 1,
    /**
     *  1:1 裁剪
     */
    NXCallVideoCrop1x1              = 2,
    /**
     *  不裁剪
     */
    NXCallVideoCropNoCrop           = 3,
};


/**
 *  网络通话类型
 */
typedef NS_ENUM(NSInteger, NXCallMediaType){
    
    NXCallMediaTypeUnknown = 0,
    /**
     *  音频通话
     */
    NXCallMediaTypeAudio   = 1,
    /**
     *  视频通话
     */
    NXCallMediaTypeVideo   = 2,
};

/**
*  网络通话中发生的事件
*/
typedef NS_ENUM(NSInteger, NXCallEvent) {
    
    NXCallEventStopAcceptVideoForLowBandwidth = 10,
    
    NXCallEventInterruptedBySystemCall = 20,
    
    NXCallEventInterruptedBySystemCallRecover = 21,
    
    NXCallEventPoorNetworkLocal = 30,
    
    NXCallEventPoorNetworkRemote = 40,
    
    NXCallEventCameraOn  = 50,
    
    NXCallEventCameraOff  = 51,
    
    NXCallEventMicMuted  = 60,
    
    NXCallEventMicOpen = 61,
    
    NXCallEventEnterBackground = 70,
    
    NXCallEventEnterForeground = 71,
    
    NXCallEventAudioInterruptedBegin = 80,
    
    NXCallEventAudioInterruptedEnd = 81,
    
    NXCallEventAudioGraphFail = 90,
};

/**
 *  视频混频模式, 用于互动直播连麦时的视频混频参数设置
 */
typedef NS_ENUM(NSUInteger, NXCallVideoMixMode) {
    /**
     *  右侧纵排浮窗(画中画)
     */
    NXCallVideoMixModeFloatingRightVertical  = 0,
    /**
     *  左侧纵排浮窗(画中画)
     */
    NXCallVideoMixModeFloatingLeftVertical   = 1,
    /**
     *  分格平铺, 显示完整画面, 不裁剪
     */
    NXCallVideoMixModeLatticeAspectFit       = 2,
    /**
     *  分格平铺, 填满区域, 可能裁剪
     */
    NXCallVideoMixModeLatticeAspectFill      = 3,
};

/**
 *  网络通话 Error Domain
 */
extern NSString *const NXCallErrorDomain;

/**
 *  网络通话错误码
 */
typedef NS_ENUM(NSInteger, NXCallErrorCode) {
    /**
     *  网络通话没有启动
     */
    NXCallErrorCodeNotStarted         = 20001,
    /**
     *  操作失败
     */
    NXCallErrorCodeOperationFailed    = 20002,
    /**
     *  超过最大允许直播节点数量
     */
    NXCallErrorCodeBypassSetExceedMax = 20202,
    
    /**
     *  必须由主播第一个开启直播
     */
    NXCallErrorCodeBypassSetHostNotJoined = 20203,
    
    /**
     *  互动直播服务器错误
     */
    NXCallErrorCodeBypassSetServerError = 20204,
    
    /**
     *  互动直播其他错误
     */
    NXCallErrorCodeBypassSetOtherError = 20205,
    
    /**
     *  互动直播服务器没有响应
     */
    NXCallErrorCodeBypassSetNoResponse = 20404,
    
    /**
     *  重连过程中无法进行相关操作，稍后再试
     */
    NXCallErrorCodeBypassReconnecting = 20405,
    
    /**
     *  互动直播设置超时
     */
    NXCallErrorCodeBypassSetTimeout   = 20408,
    
    /**
     *  与音视频服务器连接断开
     */
    NXCallErrorCodeServerDisconnected = 20409,
    
    /**
     *  对方超时离开了房间
     */
    NXCallErrorCodePeerLeftForTimeout = 20410,
    
    /**
     *  音频设备异常
     */
    NXCallErrorCodeAudioDeviceError   = 20411,
    
    /**
     *  被踢出了音视频
     */
    NXCallErrorCodeBeKicked           = 20412,
    
    
};

#endif /* NXGlobalDefs_h */
