//
//  const.h
//  RedAnt ERP Mobile
//
//  Created by Ray on 14-6-20.
//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
//
#define DEBUGLOG 1
#ifdef DEBUGLOG
    #ifdef DEBUG
   //     #define DebugLog( s, ... ) fprintf(stderr,"%s\n",[[NSString stringWithFormat:s, ##__VA_ARGS__] UTF8String])//
#define DebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
    #else
        #define DebugLog( s, ... )
    #endif
#else
    #define DebugLog( s, ... )
#endif


#define DEPRECATED(_version) __attribute__((deprecated))


#ifndef RedAnt_ERP_Mobile_const_h
#define RedAnt_ERP_Mobile_const_h




#define COLOR(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]

#define DBNAME    @"iSales.db"

#define URL_REMOTE 1
#define URL_LOCAL 0
#define URL_NONE 2
#define URL_RESTORE 3

#define RETRY_DELAY 15 //offline getting data retry delay.
#define DOWNLOAD_RETRY_TIMES 5 //retry times for single download.
#define REQUEST_DOWNLOAD_RETRY_TIMES 240 //retry times for single download.40==60 min

#define REFRESH_NONE 0
#define REFRESH_VIEW 1
#define REFRESH_DATA 2


#define AP_USER_NOT_EXIST				 0
#define AP_USER_NOT_AUTH				 1
#define AP_USER_AUTH					 2


#define AP_SESSION_EXPIRED				 4

#define AP_MESSAGE_NEW				 5
#define AP_MESSAGE_NONE					 6

//#define OFFLINE_MODE true
#define OFFLINE_ARRAY_SEPARATOR @";"
#define OFFLINE_IMG_TYPE_CATEGORY 1
#define OFFLINE_IMG_TYPE_DETAIL 0

#define RESULT_FALSE 0
#define RESULT_TRUE		 2
#define RESULT_NET_SERVER_ERR		 -1
#define RESULT_NET_ERROR			 -3
#define RESULT_NET_NOTAVAILABLE		  -4
#define RESULT_ERROR				 -5
#define RESULT_LOCALFILE_ERROR			 -7
#define RESULT_USERAUTH_ERROR			 -9
#define RESULT_UPDATE_USERAUTH_ERROR	 -11
#define RESULT_SESSION_EXPIRED			  -13
#define RESULT_VER_LOW                   -15
#define RESULT_TIMEOUT                   99

#define RESULT_LOGIN_DEVICE                   -18

#define RESULT_NO_MODEL                   8

#define CATEGORY_VIEWTYPE_SMALL 0
#define CATEGORY_VIEWTYPE_LARGE 1
#define CATEGORY_VIEWTYPE_CUSTOM 2
#define CATEGORY_VIEWTYPE_LIST 3


#define MSG_NET_NOTAVAILABLE @"No available network, please check your network setting."
#define MSG_NET_ERROR @"Net Error. Cannot connect to server for now. Please retry later."
#define MSG_USERAUTH_ERROR @"Username or password is incorrect.Please check."
#define MSG_VER_LOW @"Current App version is out of date, please update to the latest version."
#define MSG_ERROR @"Connection failed with Server, please email your IT Admin."//@"Some error occured on server."
#define MSG_SUCCESS @"Success."
#define MSG_LOGIN_DEVICE @"You are currently signed in on another device. Please check"
#define MSG_TIMEOUT @"Request timeout."

#define MSG_OFFLINE_SUBMIT @"Offline order will be submitted when you login online mode and sync with server."
#define TITLE_OFFLINE_SUBMIT @"Offline Submit"

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]


#define USER_ROLE_CUSTOMER 0
#define USER_ROLE_EMPLOYEE 1
#define USER_ROLE_UNKNOWN 2
// 如何处理commoneditor action 类型调用的返回值
#define  ACTION_SAVE_DATA 0
#define ACTION_FILL_SECTION 1

#define JSON_TIMEOUT 30

#endif
