//
//  NotificationSDK.h
//  NotificationSDK
//
//  Created by 周翔宇 on 2019/5/29.
//  Copyright © 2019 周翔宇. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "LocalNotiModel.h"
#import "NotificationResult.h"
#import "Header.h"
#import <GASDK/GAConstants.h>

NS_ASSUME_NONNULL_BEGIN

@interface NotificationSDK : NSObject

/**
 初始化方法
 @param productId 游戏productId
 @param projectId 游戏projectId
 @param cloudId cloudid
 @param clientId 客户端id
 @param appId appid
 @param teamId teamId
 @param setBadge 是否开启角标功能 YES:开启 NO:不开启
 */
+ (void)initWithProductId:(NSString *)productId projectId:(NSString *)projectId cloudId:(NSString *)cloudId clientId:(NSString *)clientId  appId:(NSString *)appId teamId:(NSString *)teamId serverUrl:(NSString *)serverurl setBadge:(BOOL)setBadge;
/**
 设置推送权限
 */
+ (void)setPushNotification;



/// 跳转到系统页面
/// @param complate ios 10以上设备发起跳转  success是跳转api回调结果，
+ (void)jumpToSystemSettingVcWithComplate:(void(^)(BOOL success))complate;;

/**
 检测推送权限
 
 @return YES:有权限。NO：没有权限
 */
//+ (BOOL)IsAllowedNotification;


/// 检测推送权限
/// @param complate 回调结果
/***
 iOS10 以上的返回数值对应以下枚举
 typedef NS_ENUM(NSInteger, UNAuthorizationStatus) {
     // The user has not yet made a choice regarding whether the application may post user notifications.
     UNAuthorizationStatusNotDetermined = 0,
     // The application is not authorized to post user notifications.
     UNAuthorizationStatusDenied = 1,
     // The application is authorized to post user notifications.
     UNAuthorizationStatusAuthorized = 2,
     // The application is authorized to post non-interruptive user notifications.
     UNAuthorizationStatusProvisional = 3
     // The application is temporarily authorized to post notifications. Only available to app clips.
     UNAuthorizationStatusEphemeral = 4
 }
 
 
 ios 10一下返回的数值对应以下枚举
 typedef NS_OPTIONS(NSUInteger, UIUserNotificationType) {
     UIUserNotificationTypeNone    = 0,      // the application may not present any UI upon a notification being received
     UIUserNotificationTypeBadge   = 1 << 0, // the application may badge its icon upon a notification being received
     UIUserNotificationTypeSound   = 1 << 1, // the application may play a sound upon a notification being received
     UIUserNotificationTypeAlert   = 1 << 2, // the application may display an alert upon a notification being received
 }
 */
+ (void)checkNotifyAuthorizationWithComplate:(void(^)(NSInteger authorization))complate;


/**
 注册本地推送

 @param localNotiModel localNotiModel
 @param completion 回调
 */
+ (void)RegistLocalNotice:(LocalNotiModel *)localNotiModel Completion:(ResultBlock)completion;

/**
 获取本地消息
 
 @param completion 回调
 */
+ (void)receiveLocalNoteInfo:(ResultBlock)completion;
/**
 注销本地推送

 @param noticeId 消息id
 */
+ (void)removeOneNotificationWithID:(NSString *)noticeId;


/**
 注销所有的本地推送
 */
+ (void)removeAllLocalNotification;

//上报token
+ (void)PushNotificationToken:(NSData *)token;

/**
 上报userId
 @param userId userid
 */
+ (void)PushNotificationTokenWithUserId:(NSString *)userId Completion:(ResultBlock)completion;

/// 初始化通知上报管理 （替换原来的bi）
/// @param debug debug环境或者release环境
/// @param gaUrlType 1 国内 2 国外
/* 使用时 确保已初始化NotificationSDK -initWithProductId:(NSString *)productId projectId:(NSString *)projectId cloudId:(NSString *)cloudId clientId:(NSString *)clientId  appId:(NSString *)appId teamId:(NSString *)teamId serverUrl:(NSString *)serverurl setBadge:(BOOL)setBadge;
 GA线上 debug no
 projectIdStr   20477
 clientIdStr    H5_5.0_tuyoo.tuyoo.0-hall20477.tuyoo.BiPush
 appIdStr       20477
 gameIdStr    20477
 --------
 GA测试 debug yes
 projectIdStr  20433
 clientIdStr    IOS_5.0_guest.appStore.0-hall20433.appStore.sdktest
 appIdStr       20433
 gameIdStr    20433
 */
+ (void)initGAWithDebug:(BOOL)debug gaUrlType:(GAServerUrl)gaUrlType;
            

/**
    确保ga已经初始化 没有初始化需要调用 + (void)initGAWithDebug:(BOOL)debug gaUrlType:(GAServerUrl)gaUrlType 先初始化ga
 */
/// 使用ga上报事件
/// @param eventType 事件类别
/// @param originParam 参数
+ (void)trackEventWithType:(NSString *)eventType originParam:(NSDictionary *)originParam;

/**
 获取消息

 @param completion 回调
 */
+ (void)receiveRemoteNoteInfo:(ResultBlock)completion;

+ (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;

/**
 @param application application
 */
+ (void)applicationDidBecomeActive:(UIApplication *)application;

+ (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
@end



NS_ASSUME_NONNULL_END
