#if !defined(RTCQUOTEAPI_API_H)
#define RTCQUOTEAPI_API_H

#include "RTCUserApiStruct.h"

#ifdef RTCQUOTEAPI_EXPORTS
#define RTCQUOTEAPI_API __declspec(dllexport)
#else
#define RTCQUOTEAPI_API __declspec(dllimport)
#endif

class RTCQuoteAPISpi
{
public:
	///當客戶端與TCore建立起通信連接時，該方法被調用。
	virtual void OnFrontConnected(){};
	
	///當客戶端與TCore通信連接斷開時，該方法被調用。
	virtual void OnFrontDisconnected(){};
		
	///心跳超時警告。當長時間未收到報文時，該方法被調用。
	///@param nTimeLapse 距離上次接收報文的時間
	virtual void OnHeartBeatWarning(int nTimeLapse){};//Unsupported
	
	///登錄請求響應
	virtual void OnRspUserLogin(ICERspUserLoginField *pRspUserLogin, ICERspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};//Unsupported

	///登出請求響應
	virtual void OnRspUserLogout(ICEUserLogoutField *pUserLogout, ICERspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};//Unsupported

	///錯誤應答
	virtual void OnRspError(ICERspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};//Unsupported

	///訂閱行情應答
	virtual void OnRspSubMarketData(ICESpecificInstrumentField *pSpecificInstrument, ICERspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};//Unsupported

	///取消訂閱行情應答
	virtual void OnRspUnSubMarketData(ICESpecificInstrumentField *pSpecificInstrument, ICERspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};//Unsupported

	///訂閱詢價應答
	virtual void OnRspSubForQuoteRsp(ICESpecificInstrumentField *pSpecificInstrument, ICERspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};//Unsupported

	///取消訂閱詢價應答
	virtual void OnRspUnSubForQuoteRsp(ICESpecificInstrumentField *pSpecificInstrument, ICERspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};//Unsupported

	///深度行情通知
	virtual void OnRtnDepthMarketData(ICEDepthMarketDataField *pDepthMarketData) {};

	///詢價通知
	virtual void OnRtnForQuoteRsp(ICEForQuoteRspField *pForQuoteRsp) {};//Unsupported

	///Greeks行情通知
	virtual void OnRtnGreeksData(ICEGreeksDataField *pGreeksData) {};
};

class RTCQUOTEAPI_API RTCQuoteAPI
{
public:
	///創建RTCQuoteAPI
	///@return 創建出的RTCQuoteAPI
	static RTCQuoteAPI *CreateRTCQuoteAPI(char *strLogPath = "");
	
	///刪除接口對象本身
	///@remark 不再使用本接口對象時,調用該函數刪除接口對象
	virtual void Release() = 0;
	
	///初始化
	///@remark 初始化運行環境,只有調用後,接口才開始工作
	virtual int Init() = 0;//Unsupported
	
	///等待接口線程結束運行
	///@return 線程退出代碼
	virtual int Join() = 0;
	
	///獲取當前交易日
	///@retrun 獲取到的交易日
	///@remark 只有登錄成功後,才能得到正確的交易日
	virtual const char *GetTradingDay() = 0;//Unsupported
	
	//連接TCore
	virtual long RegisterFront(char *strHostAddress, char *strSystemName, char *strServiceKey, int iConnectType) = 0;

	///註冊名字服務器網絡地址
	virtual void RegisterNameServer(char *pszNsAddress) = 0;//Unsupported
	
	///註冊名字服務器用戶信息
	///@param pFensUserInfo：用戶信息。
	virtual void RegisterFensUserInfo(ICEFensUserInfoField * pFensUserInfo) = 0;//Unsupported
	
	///註冊回調接口
	///@param pSpi 派生自回調接口類的實例
	virtual void RegisterSpi(RTCQuoteAPISpi *pSpi) = 0;
	
	///訂閱行情。
	///@param ppInstrumentID 合約ID  
	///@param nCount 要訂閱/退訂行情的合約個數
	///@remark 
	virtual int SubscribeMarketData(char *ppInstrumentID[], int nCount) = 0;

	///退訂行情。
	///@param ppInstrumentID 合約ID  
	///@param nCount 要訂閱/退訂行情的合約個數
	///@remark 
	virtual int UnSubscribeMarketData(char *ppInstrumentID[], int nCount) = 0;
	
	///訂閱詢價。
	///@param ppInstrumentID 合約ID  
	///@param nCount 要訂閱/退訂行情的合約個數
	///@remark 
	virtual int SubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;//Unsupported

	///退訂詢價。
	///@param ppInstrumentID 合約ID  
	///@param nCount 要訂閱/退訂行情的合約個數
	///@remark 
	virtual int UnSubscribeForQuoteRsp(char *ppInstrumentID[], int nCount) = 0;//Unsupported

	///用戶登錄請求
	virtual int ReqUserLogin(ICEReqUserLoginField *pReqUserLoginField, int nRequestID) = 0;//Unsupported
	
	///登出請求
	virtual int ReqUserLogout(ICEUserLogoutField *pUserLogout, int nRequestID) = 0;//Unsupported

	///訂閱Greeks。
	///@param ppInstrumentID 合約ID  
	///@param nCount 要訂閱/退訂行情的合約個數
	///@remark 
	virtual int SubscribeGreeksData(char *ppInstrumentID[], int nCount) = 0;

	///退訂Greeks。
	///@param ppInstrumentID 合約ID  
	///@param nCount 要訂閱/退訂行情的合約個數
	///@remark 
	virtual int UnSubscribeGreeksData(char *ppInstrumentID[], int nCount) = 0;
};

#endif