//
//  GexinPushMgr.h
//  Macalline
//
//  Created by JianjiYuan on 14-12-1.
//  Copyright (c) 2014年 JianjiYuan. All rights reserved.
//

#import "GexinSdk.h"

// 个推 development
#define kAppId           @"2uNpZB4d2u829PlfVpng71"
#define kAppKey          @"CdWDmn91B59QfDicYIg2p9"
#define kAppSecret       @"o86dca8DMi9hssEO9iIEV"

#define kGexinPushMgrPayloadRecieved    @"GexinPushMgrPayloadRecieved"

typedef enum {
    GexinStatusStoped,
    GexinStatusStarting,
    GexinStatusStarted
} GexinStatus;

@protocol GexinPushMgrDelegate <NSObject>

- (void)didTapOnNotificationWithPayload:(NSDictionary *)payload;

@end

@interface GexinPushMgr : NSObject < GexinSdkDelegate >

@property (strong, nonatomic) GexinSdk *gexinPusher;
@property (nonatomic)         GexinStatus gexinStatus;
@property (nonatomic)         int lastPayloadIndex;
@property (nonatomic, weak) id<GexinPushMgrDelegate> delegate;

@property (strong, nonatomic) NSString *appKey;
@property (strong, nonatomic) NSString *appSecret;
@property (strong, nonatomic) NSString *appID;
@property (strong, nonatomic) NSString *clientId;
@property (strong, nonatomic) NSString *payloadId;
@property (strong, nonatomic) NSString *deviceToken;

+ (GexinPushMgr *)getInstance;

- (void)registerRemoteNotification;
- (void)unRegisterRemoteNotification;

- (void)setupLocalNotification;

- (void)startSdkWith:(NSString *)appID appKey:(NSString *)appKey appSecret:(NSString *)appSecret;
- (void)stopSdk;

- (void)setDeviceToken:(NSString *)aToken;
- (BOOL)setTags:(NSArray *)aTag error:(NSError **)error;
- (NSString *)sendMessage:(NSData *)body error:(NSError **)error;

//Method To deal
- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError*)error;
- (void)didReceiveRemoteNotification:(NSDictionary *)userinfo;
- (void)didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;

- (void)applicationDidBecomeActive;
- (void)applicationDidEnterBackground;


@end
