/***************************************************************************
                   Job Data Header ( JobData.h )
                -----------------------------------------

	begin      : 2013/02/27
	copyright  : (C) 2013 Solbox Inc.
	author     : Development 1 Team
					- 2013/02/27 - 1st dadamin
	email      : dev1@solbox.com
	version    : 3.2.0

	CopyRight(C) 2005 Solbox Inc. All Rights reserved.
	Redistribution and use in source and binary forms, with or with out
	modification, are not permitted in outside of Solbox Inc.
***************************************************************************/
#ifndef __JOB_DATA_H__
#define __JOB_DATA_H__

// Map
typedef map<string, string> CJobDataMap;
typedef pair< string, string > CJobDataPair;

// Job Define
/// key
#define  KEY_JOB_TYPE			"JobType"
#define  KEY_JOBSUB_TYPE		"JobSubType"

/// kind of job
#define  JOB_SERVICE_OPEN									"ServiceOpen"
#define  JOB_SERVICE_CHANGE									"ServiceChange"
#define  JOB_SERVICE_CHG_USER								JOB_SERVICE_CHANGE"_user"
#define  JOB_SERVICE_CHG_USER_PW							JOB_SERVICE_CHG_USER"_user_password"
#define  JOB_SERVICE_CHG_PRODUCT							JOB_SERVICE_CHANGE"_product"
#define  JOB_SERVICE_CHG_PRODUCT_STORAGE					JOB_SERVICE_CHG_PRODUCT"_storage"
#define  JOB_SERVICE_CHG_PRODUCT_BANDWIDTH					JOB_SERVICE_CHG_PRODUCT"_bandwidth"
#define  JOB_SERVICE_CHG_PRODUCT_PERIOD						JOB_SERVICE_CHG_PRODUCT"_period"
#define  JOB_SERVICE_CHG_PRODUCT_AUTHINFO					JOB_SERVICE_CHG_PRODUCT"_authinfo"
#define  JOB_SERVICE_CHG_PRODUCT_REPLICATION				JOB_SERVICE_CHG_PRODUCT"_replication"
#define  JOB_SERVICE_CHG_PRODUCT_SYNC_INFO					JOB_SERVICE_CHG_PRODUCT"_sync_info"
#define  JOB_SERVICE_CHG_PRODUCT_STORAGE_CAL				JOB_SERVICE_CHG_PRODUCT"_cal_used_depth"
#define  JOB_SERVICE_CHG_PRODUCT_IGNORE_CASE				JOB_SERVICE_CHG_PRODUCT"_uri_ignore_case"
#define  JOB_SERVICE_CHG_PRODUCT_IGNORE_CASE_FROCE			JOB_SERVICE_CHG_PRODUCT"_uri_ignore_case_force"
#define  JOB_SERVICE_CHG_PRODUCT_DEL_FILE_KEEP_TIME			JOB_SERVICE_CHG_PRODUCT"_del_file_keep_time"
#define  JOB_SERVICE_CHG_EXAUTH								JOB_SERVICE_CHANGE"_exauth"
#define  JOB_SERVICE_CHG_EXAUTH_MODE						JOB_SERVICE_CHG_EXAUTH"_mode"
#define  JOB_SERVICE_CHG_EXAUTH_INFO						JOB_SERVICE_CHG_EXAUTH"_info"
#define  JOB_SERVICE_CHG_EXAUTH_REFERER_CHK					JOB_SERVICE_CHG_EXAUTH"_referer_chk"
#define  JOB_SERVICE_CHG_BAND								JOB_SERVICE_CHANGE"_band"
#define  JOB_SERVICE_CHG_BAND_MODE							JOB_SERVICE_CHG_BAND"_mode"
#define  JOB_SERVICE_CHG_BAND_VOLUME_LIMIT					JOB_SERVICE_CHG_BAND"_volume_limit"
#define  JOB_SERVICE_CHG_BAND_SESSION_LIMIT					JOB_SERVICE_CHG_BAND"_session_limit"
#define  JOB_SERVICE_CHG_STATUS								JOB_SERVICE_CHANGE"_status"
#define  JOB_SERVICE_CHG_SYNC								JOB_SERVICE_CHANGE"_sync"
#define  JOB_SERVICE_CHG_MOVE								JOB_SERVICE_CHANGE"_move"
#define  JOB_SERVICE_CHG_MOVE_RQE							JOB_SERVICE_CHG_MOVE"_request"
#define  JOB_SERVICE_CHG_MOVE_COMP							JOB_SERVICE_CHG_MOVE"_complete"
#define	 JOB_VOLUME_INFO									"VolumeInfo" 
#define	 JOB_ANONY_DIR										"AnonyDir" 
#define	 JOB_ANONY_DIR_SET									JOB_ANONY_DIR"_set" 
#define	 JOB_ANONY_DIR_UNSET								JOB_ANONY_DIR"_unset" 
#define	 JOB_ANONY_DIR_GET									JOB_ANONY_DIR"_get" 
#define	 JOB_FILE_CTL										"FileControl" 
#define	 JOB_FILE_CTL_EXIST									JOB_FILE_CTL"_exist" 
#define	 JOB_FILE_CTL_MKDIR									JOB_FILE_CTL"_mkdir" 
#define	 JOB_FILE_CTL_GET_HASH								JOB_FILE_CTL"_get_hash" 
#define	 JOB_FILE_CTL_GET_HASH_10MB							JOB_FILE_CTL_GET_HASH"_10MB"
#define	 JOB_FILE_CTL_TOTO_EXTRACT							JOB_FILE_CTL_GET_HASH"_TOTO"
#define	 JOB_FILE_CTL_TOTO_EXTRACT_WITHPLATFORM				JOB_FILE_CTL_TOTO_EXTRACT"_withplatform"
#define  JOB_SERVICE_MOVE									"SvcMove"
#define  JOB_SERVICE_MOVE_REQUEST							JOB_SERVICE_MOVE"_Request"
#define  JOB_SERVICE_MOVE_COMPLETE							JOB_SERVICE_MOVE"_Complete"

// service status code
#define SERVICE_STATUS_ING						"SVC_STATUS_ING"	// 서비스 중
#define SERVICE_STATUS_CLOSE					"SVC_STATUS_CLOSE"	// 해지
#define SERVICE_STATUS_STOP						"SVC_STATUS_STOP"	// 중지
#define SERVICE_STATUS_REMOVE					"SVC_STATUS_REMOVE"	// 삭제

// sync link code
#define SYNC_LINK_CODE_LINK				"LINK"		// 설정
#define SYNC_LINK_CODE_UNLINK			"UNLINK"	// 해제
#define SYNC_LINK_ONE_WAY				"TRUE"		// 요청 받은 링크 정보를 자신만 처리

/// value key 
#define	KEY_REQ_REG_DATE			"Requset_RegDate"
#define	KEY_REQ_USER_PASS_CRYPTED	"Requset_user_pass_Crypted"
#define	KEY_REQ_URI					"Requset_URI"
#define	KEY_REQ_DATA_NUM			"Requset_data_num"
#define	KEY_REQ_HASH_CHECK_SIZE		"Requset_Hach_Chek_Size"
#define	KEY_REQ_AUTH_MODE			"Requset_auth_mode"
#define	KEY_REQ_BAND_MODE			"Requset_band_mode"
#define	KEY_REQ_EXT_AUTH_SET		"Requset_ext_auth_set"
#define	KEY_REQ_EXT_AUTH_UNSET		"Requset_ext_auth_unset"
#define	KEY_REQ_BAND_LIMIT_SET		"Requset_band_limit_set"
#define	KEY_REQ_BAND_LIMIT_UNSET	"Requset_band_limit_unset"
#define	KEY_REQ_SVC_STATUS			"Requset_Service_Status"
#define	KEY_REQ_LINK_CODE			"Requset_Link_Code"
#define	KEY_REQ_LINK_ONE_WAY		"Requset_Link_One_Way"
#define	KEY_REQ_MOVE_NOW_RCTS		"Requset_Move_Now_RCTS"
#define	KEY_REQ_MOVE_NEW_RCTS		"Requset_Move_New_RCTS"
#define KEY_RES_URI					"Response_URI"
#define KEY_RES_FILE_SIZE			"Response_file_size"
#define KEY_RES_FILE_FRONT_10M_MD5	"Response_file_F_10_MD5"
#define KEY_RES_FILE_TOTO_MD5		"Response_file_TOTO_MD5"
#define KEY_RES_FILE_TOTO_CHECKSUM	"Response_file_TOTO_checksum"
#define KEY_RES_FILE_TOTO_DNAKEY	"Response_file_TOTO_dnakey"
#define KEY_RES_XML_JOB_TYPE		"Response_XML_JobType"
#define KEY_RES_XML_JOB_TYPE_List	"Response_XML_JobType_List"


#define KEY_URI						"uri"
#define KEY_URI_PARENT				"uri_parent"
//// t_sms_sp_user
#define	KEY_SP_USER_SEQ				"sp_user_seq"
#define	KEY_SP_USER_ID				"sp_user_id"
#define	KEY_SP_USER_PASSWORD		"sp_user_password"
#define KEY_DEL_USER_INFO			"del_yn"

//// t_sms_sp_svc_product
#define	KEY_SP_SVC_TRAN_ID				"sp_svc_tran_id"
#define	KEY_SP_SVC_ID					"sp_svc_id"
#define	KEY_SP_SVC_BEGIN_DATE			"sp_svc_begin_date"
#define	KEY_SP_SVC_END_DATE				"sp_svc_end_date"
#define	KEY_INITIAL_VECTOR				"initial_vector"
#define	KEY_PRIVATE_KEY					"private_key"
#define	KEY_MAX_BANDWIDTH				"max_bandwidth"
#define	KEY_MAX_STR_SIZE				"max_str_size"
#define KEY_VALIDATE_SP_SESSION_ID_YN	"validate_sp_session_id_yn"
#define KEY_BANDWIDTH_CTRL_YN			"bandwidth_ctrl_yn"
#define KEY_REFERER_CHK_YN				"referer_chk_yn"
#define KEY_REPLICATION_COUNT			"replication_count"
#define KEY_CAL_USED_DEPTH				"cal_used_depth"
#define KEY_URI_IGNORE_CASE				"uri_ignore_case"
#define KEY_DEL_FILE_KEEP_TIME			"del_file_keep_time"
#define KEY_DEL_PRODUCT					"del_yn"


//// t_sms_sp_svc_product_val
#define  KEY_AUTH_SERVER				"auth_server"
#define  KEY_AUTH_PATH					"auth_path"
#define  KEY_AUTH_PORT					"auth_port"
#define  KEY_AUTH_TIMEOUT				"auth_timeout"
#define  KEY_BILL_SERVER				"bill_server"
#define  KEY_BILL_PATH					"bill_path"
#define  KEY_BILL_PORT					"bill_port"
#define  KEY_BILL_TIMEOUT				"bill_timeout"
#define  KEY_REFERER_CHK_URL			"referer_chk_url"
#define  KEY_REFERER_CHK_FILETYPE		"referer_chk_filetype"

//// t_sms_sp_svc_product_band
#define  KEY_VOLUME_BANDWIDTH_LIMIT		"volume_bandwidth_limit"
#define  KEY_SESSION_BANDWIDTH_LIMIT	"session_bandwidth_limit"

//// t_sms_sp_svc_product_sync
#define  KEY_LINK_MASTER_YN				"master_yn"
#define  KEY_LINK_SP_SVC_TRAN_ID		"linked_sp_svc_tran_id"
#define  KEY_LINK_RCTS					"linked_rcts"

//// t_dav_use_dir
#define KEY_DIR_USED			"dir_used"
#define KEY_DEL_DIR_USED		"del_yn"

//// meta table
#define KEY_HOST_NAME			"host_name"	
#define KEY_RESOURCE_TYPE		"resource_type"
#define KEY_FILENAME_HASH		"filename_hash"
#define KEY_GET_CONTENT_LENGTH	"get_content_length"
#define KEY_DEL_ROOT			"del_yn"

///// internal data 
#define KEY_SYNC_LIST			"sync_list"	
#define KEY_SELF_RCTS			"self_rcts"
#define KEY_LINK_USER_SEQ		"linked_user_seq"

///// response 
#define  KEY_RESP_RESULT		"Result"
#define  KEY_RESP_RESULT_CODE	"ResultCode"
#define	 KEY_VOLUME_ID			"VolumeID"
#define	 KEY_VOLUME_SEQ			"VolumeSEQ"

#define JOB_SUCCESS						0
#define JOB_SKIP						1

#define JOX_RESULT_OK					"OK"
#define JOX_RESULT_FAIL					"Failed"

/////  Job Error 
#define JOB_ERR_UNKNOWN					-1
#define JOB_ERR_INITIALIZATION			JOB_ERR_UNKNOWN-1
#define JOB_ERR_CREATION_FAIL			JOB_ERR_INITIALIZATION-1
#define JOB_ERR_ALLOCATION_FAIL			JOB_ERR_INITIALIZATION-2
#define JOB_ERR_RCDB_BEGIN_TRANS		JOB_ERR_INITIALIZATION-3
#define JOB_ERR_RCDB_END_TRANS			JOB_ERR_INITIALIZATION-4
#define JOB_ERR_READ_HEADER				JOB_ERR_INITIALIZATION-5
#define JOB_ERR_READ_BODY				JOB_ERR_INITIALIZATION-6
#define JOB_ERR_CONVERT					JOB_ERR_INITIALIZATION-7  // -9
#define JOB_ERR_CHK						-100
#define JOB_ERR_CHK_USER				JOB_ERR_CHK-1
#define JOB_ERR_CHK_PRODUCT				JOB_ERR_CHK-2
#define JOB_ERR_CHK_ANOTHER_PRODUCT		JOB_ERR_CHK-3
#define JOB_ERR_CHK_PRODUCT_EXTAUTH		JOB_ERR_CHK-4
#define JOB_ERR_CHK_PRODUCT_BAND		JOB_ERR_CHK-5
#define JOB_ERR_CHK_PRODUCT_SYNC		JOB_ERR_CHK-6
#define JOB_ERR_CHK_VOLUME_INFO			JOB_ERR_CHK-7
#define JOB_ERR_CHK_ROOT_INFO			JOB_ERR_CHK-8		
#define JOB_ERR_CHK_HAS_FILE			JOB_ERR_CHK-9		
#define JOB_ERR_CHK_POLICY_IGNORECASE	JOB_ERR_CHK-10		
#define JOB_ERR_CHK_FILE_INFO			JOB_ERR_CHK-11		
#define JOB_ERR_CHK_PARENT				JOB_ERR_CHK-12		// -112
#define JOB_ERR_SET						-200
#define JOB_ERR_SET_USER				JOB_ERR_SET-1
#define JOB_ERR_SET_PRODUCT				JOB_ERR_SET-2
#define JOB_ERR_SET_PRODUCT_EXTAUTH		JOB_ERR_SET-3
#define JOB_ERR_SET_PRODUCT_BAND		JOB_ERR_SET-4
#define JOB_ERR_SET_PRODUCT_SYNC		JOB_ERR_SET-5
#define JOB_ERR_SET_PRODUCT_MOVE		JOB_ERR_SET-6
#define JOB_ERR_SET_VOLUME_INFO			JOB_ERR_SET-7
#define JOB_ERR_SET_ROOT_INFO			JOB_ERR_SET-8
#define JOB_ERR_SET_ANONY_DIR			JOB_ERR_SET-9
#define JOB_ERR_DEL_ROOT_INFO			JOB_ERR_SET-10		
#define JOB_ERR_DEL_VOLUME_INFO			JOB_ERR_SET-11
#define JOB_ERR_DEL_PRODUCT_BAND		JOB_ERR_SET-12		
#define JOB_ERR_DEL_PRODUCT_EXTAUTH		JOB_ERR_SET-13		
#define JOB_ERR_DEL_PRODUCT_SYNC		JOB_ERR_SET-14		
#define JOB_ERR_DEL_PRODUCT				JOB_ERR_SET-15	
#define JOB_ERR_DEL_USER				JOB_ERR_SET-16		// -216
#define JOB_ERR_JOB						-300
#define JOB_ERR_NOT_FOUND_JOB			JOB_ERR_JOB-1
// 2015-03-11 dadamin 
// JOB_ERR_USER_EMPTY(-302), JOB_ERR_PRODUCT_EMPTY(-303) 값은 
// WebAdmin에서 참조 하므로 해당 값은 변경될 수 없음
#define JOB_ERR_USER_EMPTY				JOB_ERR_JOB-2
#define JOB_ERR_PRODUCT_EMPTY			JOB_ERR_JOB-3
#define JOB_ERR_USER_DIFF				JOB_ERR_JOB-4
#define JOB_ERR_PRODUCT_DIFF			JOB_ERR_JOB-5
#define JOB_ERR_MISS_PASSWROD			JOB_ERR_JOB-6
#define JOB_ERR_MK_ROOT					JOB_ERR_JOB-7
#define JOB_ERR_GET_VOLUME_INFO			JOB_ERR_JOB-8
#define JOB_ERR_REQ_EXCEED				JOB_ERR_JOB-9
#define JOB_ERR_GET_ANONY_DIR			JOB_ERR_JOB-10
#define JOB_ERR_SEND_ANONY_DIR			JOB_ERR_JOB-11		
#define JOB_ERR_HAS_FILE				JOB_ERR_JOB-12		// - 312
#define JOB_ERR_FILE					-400
#define JOB_ERR_FILE_HASH				JOB_ERR_FILE-1
#define JOB_ERR_FILE_EXIST				JOB_ERR_FILE-2
#define JOB_ERR_FILE_CHK_IGNORECASE		JOB_ERR_FILE-3
#define JOB_ERR_FILE_NOT_FOUND			JOB_ERR_FILE-4
#define JOB_ERR_FILE_MKDIR_PARENT		JOB_ERR_FILE-5
#define JOB_ERR_FILE_MKDIR				JOB_ERR_FILE-6

class CJob;
// Abstract Factory returning a Job
class CJobFactory 
{
public:
	CJob* CreateJob(CJobDataMap &jobMap);
};

#endif // __JOB_DATA_H__
