#ifndef __OPEN_AVD_N2M_RoomProfile_H__
#define __OPEN_AVD_N2M_RoomProfile_H__

#include <QtCore/QString>
#include <QtGui/QImage>
#include <QtGui/QIcon>

#ifdef USE_3TEE_SDK_API_C
#include <string>
#include "api_c/common_c.h"
#include "api_c/videorender_c.h"
#else
#include "api/common.h"
#include "api/videorender.h"
#endif
#include "defmarco.h"

#ifdef _MSC_VER
#define QSTRING(s) QString((const QChar*)L##s)
#define YAHEI QSTRING("Microsoft YaHei")
#else
#define QSTRING(s) QString(s)
#define YAHEI QSTRING("Microsoft YaHei")
#endif

using namespace rtc;


class CRoomProfile {
protected:
	 CRoomProfile();
	~CRoomProfile();
public:
	static CRoomProfile* Instance();
	static QString getErrorInfo(QString msg, Result ret);
	QString getAppKey();
	QString getSecretKey();

	enum VideoPubType{
		vp_single,
		vp_2_codec,
		vp_3_svc,
	};
public:
	QString GetLogo() const;
	QImage  GetTitleBarLogo() const;
	QIcon	GetAppIcon() const;
	///
	const QString& GetSiteUrl() const { return m_siteurl; }
	const QString& GetRootUrl() const { return m_rooturl; }
	const QString& GetInviteUrl();
	const QString& GetRtmpUrl() const { return m_rtmpurl; }
	const QString& GetHlsUrl() const { return m_hlsurl; }
	const QString& GetRoomMode() const { return m_roommode; }
	const QString& GetRoomID() const { return m_roomid; }
	void SetRoomID(const QString& roomId);
	const QString& GetUserID() const { return m_userid; }
	void SetUserID(const QString& userId);
	VideoRatio GetVideoRatio() const { return m_video_ratio; }
	bool SetVideoRatio(VideoRatio value);
	VideoCodec GetVideoCodec() const { return m_video_codec; }
	bool SetVideoCodec(VideoCodec value);
	VideoPubType GetVideoPubType() const { return m_video_pubtype; }

	const String& GetAudioCodec() const { return m_audio_codec; }
	void SetAudioCodec(const String& value) { m_audio_codec = value; }
	SCALING_TYPE GetRenderType() const { return m_render_scaling_type; }
	bool SetRenderType(SCALING_TYPE renderType);
	bool SetVideoPubType(VideoPubType value);
	bool IsDtls() const { return m_dtlsflag; }
	bool SetDtls(bool value);
	bool IsDataTcp() const { return m_datatcp; }
	bool SetDataTcp(bool value);
	bool IsAutoVideo() const { return m_auto_video; }
	bool SetAutoVideo(bool value);
	bool IsAutoAudio() const { return m_auto_audio; }
	bool SetAutoAudio(bool value);
	
	bool HasLivecast() const { return m_has_livecast; }
	bool SetLivecast(bool value);
	bool IsMainBroadcaster () const { return m_ismainbroadcaster; }
	void SetMainBroadcaster(bool value);
	MixerVideoLayoutType GetLivecastVideoLayout() const { return m_lvvideolayout; }
	void SetLivecastVideoLayout(MixerVideoLayoutType value);
	bool IsPubMixerVideo() const { return m_pubMixerVideo; }
	void SetPubMixerVideo(bool value);
	bool IsUseGDIRender() const { return m_usedGDIRender; }
	int GetAudioDelayOffset() const { return m_audioDelayOffset; }
	bool IsAudio_aec_DAEcho() const { return m_audio_aec_DAEcho; }
	bool IsAudio_noiseSuppression() const { return m_audio_noiseSuppression; }
	bool IsAudio_autoGainControl() const { return m_audio_autoGainControl; }
	bool IsAudio_highpassFilter() const { return m_audio_highpassFilter; }
	void SetOutgoingAddress(const QString& value);
	void SetOutgoingUser(const QString& value);
	void SetOutgoingPass(const QString& value);
	const QString& GetOutgoingAddress() const { return m_outgoingAddress; }
	const QString& GetOutgoingUser() const { return m_outgoingUser; }
	const QString& GetOutgoingPass() const { return m_outgoingPass; }
	const QString& GetRouteParams() const { return m_route_params; }
protected:
	bool loadProfileFile();
	void writeSetting(const QString &key, const QVariant &value);
protected:
	QString		m_siteurl;
	QString		m_rooturl;
	QString		m_inviteurl;
	QString		m_rtmpurl;
	QString		m_hlsurl;
	QString		m_roomid;
	QString		m_userid;
	QString		m_roommode;
	bool		m_dtlsflag;
	bool		m_datatcp;
	bool		m_auto_audio;
	bool		m_auto_video;
	bool		m_has_livecast;
	VideoRatio	m_video_ratio;
	VideoCodec	m_video_codec;
	VideoPubType	m_video_pubtype;
	CAMERA_CAP m_maxcap;
    SCALING_TYPE m_render_scaling_type;
	String		m_audio_codec;
	
	bool		m_ismainbroadcaster;
	MixerVideoLayoutType m_lvvideolayout;
	bool		m_usedGDIRender;
	int			m_audioDelayOffset;
	bool		m_pubMixerVideo;
	QString		m_outgoingAddress;
	QString		m_outgoingUser;
	QString		m_outgoingPass;
	bool m_audio_aec_DAEcho;
	bool m_audio_noiseSuppression;
	bool m_audio_autoGainControl;
	bool m_audio_highpassFilter;
	QString m_accessKey;
	QString m_secretKey;
	QString m_route_params;
};

#endif //__OPEN_AVD_N2M_RoomProfile_H__
