#ifndef __BILL_MESSAGE_H__
#define __BILL_MESSAGE_H__

#define LEN_BILL_GUID			30
#define LEN_BILL_VIEWNAME		60
#define LEN_CATALOG_GUID		30
#define LEN_ITEM_GUID			30
#define LEN_SESSION_GUID		30

#define BILL_SECTION_HOUR		6
#define BILL_SECTION_DAY		4
#define BILL_SECTION_BEGIN		2
#define BILL_SECTION_FREE		50

#ifdef __BILLING_SERVER__
#define MSG_UNKNOWN 0
#endif

typedef enum __tagBillMessage
{
	BM_UNKNOWN = 0,				// RESERVED

	BM_CONNECT,					// CONNECTOR LOGIN MESSAGE			SERVER_VERSION:INT, SERVER_NAME:STR, SERVER_NUMBER:N

	BM_LOGIN_REQ,				// USER LOGIN REQUEST				SUBNO:INT USERINDEX:INT
	BM_LOGIN_REP,				// USER LOGIN REPLY					SUBNO:INT USERINDEX:INT, ERRORCODE:INT, BILL_GUID:STR, BILL_VIEWNAME:STR, BILL_SECTION:INT, SURPLUS:INT, YEAR:INT, MON:INT, DAY:INT, HOUR:INT, MIN:INT, REMAIN:INT, EXISTRESERVE:INT, RB_GUID:STR, RB_VALUE:INT, RB_NAME:STR

	BM_LOGOUT_REQ,				// USER LOGOUT REQUEST				SUBNO:INT USERINDEX:INT

	BM_USERINFO_REQ,			// USER INFO REQUEST				SUBNO:INT USERINDEX:INT
	BM_USERINFO_REP,			// USER INFO REPLY					SUBNO:INT USERINDEX:INT, ERRORCODE:INT, BILL_GUID:STR, BILL_VIEWNAME:STR, BILL_SECTION:INT, SURPLUS:INT, YEAR:INT, MON:INT, DAY:INT, HOUR:INT, MIN:INT, REMAIN:INT, EXISTRESERVE:INT, RB_GUID:STR, RB_VALUE:INT, RB_NAME:STR, ISWARN:INT, ISTIMEOUT:INT

	BM_SECTION_REQ,				// SECTION LIST REQUEST				SUBNO:INT USERINDEX:INT
	BM_SECTION_REP,				// SECTION LIST REPLY				SUBNO:INT USERINDEX:INT, FLAG:INT, BILL_GUID:STR, BILL_SECTION:INT, BILL_HOUR:INT, BILL_VALUE:INT, BILL_VIEWNAME:STR
								// FLAG: BIT0:START, BIT1:END, BIT2:EMPTY
	BM_PAY_RESERVE_REQ,			// USE RESERVE(OR CURRENT) REQUEST	SUBNO:INT USERINDEX:INT
	BM_PAY_OTHER_REQ,			// USE OTHER SECTION REQUEST		SUBNO:INT USERINDEX:INT BILL_GUID:STR
	BM_PAY_REP,					// PAYMENT REPLY					SUBNO:INT USERINDEX:INT, ERRORCODE:INT, BILL_GUID:STR, BILL_VIEWNAME:STR, BILL_SECTION:INT, SURPLUS:INT, YEAR:INT, MON:INT, DAY:INT, HOUR:INT, MIN:INT, REMAIN:INT, EXISTRESERVE:INT, RB_GUID:STR, RB_VALUE:INT, RB_NAME:STR, ISAUTO:INT

	BM_USER_REG_REQ,			// USER REGIST REQUEST				SUBNO:INT USERINDEX:INT
	BM_USER_REG_REP,			// USER REGIST REPLY				SUBNO:INT USERINDEX:INT ERRORCODE:INT

	BM_ITEM_REQ,				// CS->BS				: userindex(n)
	BM_ITEM_REP,				// BS->CS				: subno(n) userindex(n) billcount(n) bill_guid(str) itemcount(n) index(n) itemindex(n) itemplus(str) itemflag(n) itemnum(n)

	BM_SET_ITEM_REQ,
	BM_SET_ITEM_REP,

} BILLMESSAGE_TYPE;

typedef enum _tagMsgBBillInfoItemErrorType
{
	MSG_BBILLINFO_ERROR_SUCCESS,		// 지급 성공
	MSG_BBILLINFO_ERROR_NOTLIST,		// 리스트가 없음
	MSG_BBILLINFO_ERROR_CONN,		// 커넥터 서버 에러
	MSG_BBILLINFO_ERROR_BILL,		// 빌링서버 에러
	MSG_BBILLINFO_ERROR_NOTGIVE,		// 지급 에러 메세지
} MSG_BBILLINFO_ITEM_ERROR_TYPE;

typedef enum __tagLoginRepErrorType
{
	BM_LOGIN_REP_ERROR_UNKNOWN = -1,	// UNKNOWN ERROR
	BM_LOGIN_REP_ERROR_OK = 0,			// OK
	BM_LOGIN_REP_ERROR_NOTFOUND,		// NOT FOUND USER
	BM_LOGIN_REP_ERROR_NOFREEEVENT,		// EXPIRE FREE EVENT
} BM_LOGIN_REP_ERROR_TYPE;

typedef enum __tagUserInfoErrorType
{
	BM_USERINFO_ERROR_UNKNOWN = -1,		// UNKNOWN ERROR
	BM_USERINFO_ERROR_OK = 0,			// OK
	BM_USERINFO_ERROR_NOTFOUND,			// NOT FOUND USER
} BM_USERINFO_ERROR_TYPE;

typedef enum __tagFlagBit
{
	BM_FLAG_START			= 0x01,			// START
	BM_FLAG_END				= 0x02,			// END
	BM_FLAG_EMPTY			= 0x04,			// EMPTY
	BM_FLAG_WARN			= 0x08,			// WARN
	BM_FLAG_POSTUSERINFO	= 0x08,			// POST USER INFO MESSAGE
} BM_FLAG_BIT;

typedef enum __tagPayErrorType
{
	BM_PAY_ERROR_UNKNOWN = -1,			// UNKNOWN
	BM_PAY_ERROR_OK = 0,				// OK
	BM_PAY_ERROR_NOTFOUND,				// NOT FOUND PREPAY INFO
	BM_PAY_ERROR_NOPOINT,				// NOT ENOUGH POINT
} BM_PAY_ERROR_TYPE;

typedef enum __tagUserRegErrorType
{
	BM_USER_REG_ERROR_UNKNOWN = -1,		// UNKNOWN
	BM_USER_REG_ERROR_OK = 0,			// OK
	BM_USER_REG_ERROR_NOTFOUND,			// NOT FOUND USER
} BM_USER_REG_ERROR_TYPE;

#endif // __BILL_MESSAGE_H__
