//
//  iSalesNetwork.h
//  RedAnt ERP Mobile
//
//  Created by Ray on 14-6-20.
//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "const.h"
#import "config.h"
#import "AppDelegate.h"
#import "Reachability.h"
#import "iSalesDB.h"
#import "RAUtils.h"
@interface iSalesNetwork : NSObject
+(void) LoadImage:(NSString*) url into:(UIImageView*) container;
+(NSDictionary*) portfolio_remove:(NSString* ) item_ids;
+(NSDictionary*)request_Portfolio:(int)sort;

+(NSDictionary*) delete_portfoliolist:(NSString* ) listid;

+(NSDictionary*) add_toPortfolio:(NSString* ) item_id;
+(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params;
+(int)Authorize : (NSString*) user password:(NSString*) password ;
+(NSDictionary*)logout;
+(NSDictionary*)request_Cagegory;
+(NSDictionary*)load_HomePage: (int) price_template customid:(int) customid;
+(NSDictionary*)retrieve_password: (NSString*) user email:(NSString*) email;

+(NSDictionary*)request_model_qty: (NSString*) fashionId;

+(NSDictionary*)commoneditor_partialrefresh: (NSMutableDictionary*)params url:(NSString*)url;

//+(NSDictionary*)Search: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword;
+(NSDictionary*)Category: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip ;

+(bool) IsNetworkAvailable;
+(int)parse_authinfo : (NSData *) json user:(NSString*) user password:(NSString*) password;



+(NSDictionary*)request_ItemDetail: (NSString* ) item_id model_name:(NSString*) model_name category_id:(NSString*) category_id use_name :(bool) use_name;

+(NSDictionary*) cart_incresement:(NSString*) cart_id increse:(bool) increse;
+(NSDictionary*) cart_setQTY:(NSString*) cart_id value:(int) value;
+(NSDictionary*) cart_setPrice:(NSString*) cart_id price:(float) price discount:(float) discount notes:(NSString*) notes;
+(NSDictionary*) cart_setFree:(NSString*) cart_id isfree:(bool) isfree;

+(NSDictionary*) cart_setItemNote:(NSString*) cart_id notes:(NSString*) notes;

+(NSDictionary*) cart_setGeneralNote:(NSString*) order_code notes:(NSString*) notes;

+(NSDictionary*) check_Offline:(NSString* )ver  useInternalAddress:(bool)buseinternaladdress vid:(NSString*) vid;
+(NSDictionary*) download_Offline:(NSString* )vid;
+(NSDictionary*) finish_download_Offline:(NSString* )vid;

+(NSDictionary*) add_toCart:(NSString* ) item_id count:(int) count;
+(NSDictionary*) add_toCart_byName:(NSString* ) model_name;
+(NSDictionary*) add_toWatchList:(NSString* ) item_id;
+(NSDictionary*)request_Cart:(int)sort;
+(NSDictionary*)request_WatchList:(int)sort;
+(NSDictionary*) portfolio_setPrice:(NSString*) watchlist_id price:(float) price discount:(float) discount QTY:(int)qty qty_p:(float) qty_p notes:(NSString*)notes;
//+(NSDictionary*) portfolio_setQTY:(NSString*) watchlist_id QTY:(int)qty;

+(NSDictionary*) cart_remove:(NSString* ) item_ids;
//+(NSDictionary*) cart_check:(NSString* ) item_ids;
+(NSDictionary*) watchlist_remove:(NSString* ) item_ids;

+(NSDictionary*) move_wish2cart:(NSString* ) item_ids;
+(NSDictionary*) move_cart2wish:(NSString* ) item_ids;

+(NSDictionary*)request_OrderList:(int ) offset limit :(int)limit keywords :(NSString* ) keywords status:(NSString*) status_code customer:(NSString*) customer is_merged:(BOOL) isMerged;
+(NSDictionary*)request_OrderDetail:(NSString* ) orderid;
+(NSDictionary*)commit_Order:(NSString*) order_code;// saved:(bool) saved;
+(NSDictionary*)copy_Order:(NSString*) order_code;
+(NSDictionary*)sign_Order:(NSString*) order_code path:(NSString*)path;
+(NSDictionary*)update_OrderCustomer:(NSString*) order_code customerinfo:(NSMutableDictionary*)info;
+(NSDictionary*)saveandcommit_Order:(NSMutableDictionary*)params;
+(NSDictionary*) new_Order;
+(NSDictionary*)open_Order:(NSString*) order_code;
+(NSDictionary*)release_Order:(NSString*) order_code;
+(NSDictionary*)save_Order:(NSMutableDictionary*)params;
+(NSDictionary*)delete_Order:(NSString*) order_id;
+(NSDictionary*)cancel_Order:(NSString*) order_id order_code:(NSString*) order_code;
+(NSDictionary*)request_PendingOrder:(NSString* ) contactid;
+(NSDictionary*)request_CustomerInfo:(NSString* ) contactid;
+(NSDictionary*)update_customer_img: (NSString*) contactid img_url:(NSString*) url ;
//+(NSDictionary*) new_Customer;
+(NSDictionary*)save_newCustomer:(NSMutableDictionary*)params;
+(NSDictionary*)update_Customer:(NSMutableDictionary*)params;

+(NSDictionary*)create_Address:(NSMutableDictionary*)params;
+(NSDictionary*)request_ContactList:(int) offset limit:(int)limit keywords:(NSString*) keywords type:(NSString*) contact_type adv_search:(NSDictionary*)upparams;


+(NSDictionary*)Search:(long ) offset limit :(long)limit keywords :(NSString*) keywords matchfull:(bool)matchfull;
+(NSDictionary*)ItemSearch:(long ) offset limit :(long)limit covertype:(NSString* ) covertype ctgid:(NSString*)ctgid modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller;

+(NSDictionary*)request_Editor:(NSString*) request_url params:(NSMutableDictionary*)params;

+(NSString*)DataTOjsonString:(id)object;


+(NSDictionary*)request_PDFList:(int ) offset limit:(int)limit keywords:(NSString* ) keywords ;
+(NSDictionary*)request_TearSheet:(NSMutableDictionary*)params;
+(NSDictionary*)save_TearSheet:(NSMutableDictionary *)params;
+(NSDictionary*)direct_save_TearSheet:(NSMutableDictionary*)params;//(NSString*) request_url name:(NSString*)name delete:(NSString* )ids note:(NSString* )saveNote modelIds:(NSDictionary *)modelIds;


+(NSDictionary*)Category_addall: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword  offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip orderCode:(NSString*) orderCode addTo:(NSString*) addTo;
//+(NSDictionary*)category_addall2wish: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword  offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip;
//+(NSDictionary*)category_addall2portfolio: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword  offset:(long) offset limit:(long) limit alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip;

+(NSString*) create_portfolio:(NSMutableDictionary*)params ;

+(NSDictionary*)Search_addall:(long ) offset limit :(long)limit keywords :(NSString*) keywords matchfull:(bool)matchfull orderCode:(NSString*) orderCode  addTo:(NSString*) addTo;

+(NSDictionary*)ItemSearch_addall:(long ) offset limit :(long)limit covertype:(NSString* ) covertype ctgid:(NSString*)ctgid modelname:(NSString*) modelname modeldescrip:(NSString*)modeldescrip alert:(NSString*)alert qty:(NSString*)qty available:(NSString*)available price:(NSString*)price bestseller:(NSString*)bestseller orderCode:(NSString*) orderCode addTo:(NSString*) addTo;

+(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code;
//+(NSDictionary*)category_LoadMore: (NSString*) category customid:(int) customid price_template:(int) price_template sort:(int) sort_by filter:(NSString*) filter keyword:(NSString*) keyword offset:(int)offset;
//+(NSData*)fake_json:(NSString*) url;
//+(NSDictionary*)request_ItemDetail: (NSString* ) item_id category_id:(NSString*) category_id price_template:(int) price_template customid:(int) customid;

//+(NSDictionary*)request_OrderInfo:(NSString*) orderid;
//+(NSDictionary*)request_Editor:(NSString*) sourceid editor:(NSString*)editor;


//+(NSString *)flattenHTML:(NSString *)html trimWhiteSpace:(BOOL)trim;

+ (NSDictionary *)set_npd_shop_price_type:(NSInteger) priceType;

+ (NSDictionary *)get_npd_shop_givenPrice;

+ (NSDictionary *)set_npd_shop_givenPrice:(NSMutableDictionary *)params;

+ (NSDictionary *)merge_order:(NSMutableDictionary *)params;

+ (NSDictionary *)lock_order:(NSString *)oderCode;

+ (NSDictionary *)quoteOrder:(NSString *)so_id emailAddr:(NSString *)addr;// email cart as quote

+ (NSDictionary *)notifyModel:(NSString *)modelID emailAddr:(NSString *)addr;

@end
