//
//  DOPushNotificationTest.h
//  DOCore
//
//  Created by Ben Dolman on 4/25/15.
//
//

#import <Foundation/Foundation.h>
#import <DOCore/DOPushNotificationTest.h>
@class DOWebClient;

/**
 * To test push notifications:
 * 
 * 1. When your app receives a push notification of type "ping", pass the userInfo portion
 *    of that notification to -[[DOPushNotification defaultTester] handlePingNotification:].
 * 2. Create a test instance by calling
 *    -[[DOPushNotification defaultTester] testWithWebClient:timeout:completionHandler].
 * 3. Call -start on the test instance.
 */
@interface DOPushNotificationTester : NSObject

+ (instancetype)defaultTester;

/**
 * Your app must call this whenever it receives a push notification of type "ping"
 *
 * @param userInfo The dictionary passed by the system to your notification handler.
 */
- (void)handlePingNotification:(NSDictionary *)userInfo;

/**
 * Create a new push notification test. You must call -start on this object to begin the test.
 *
 * @param webClient Client to use to communicate with server. Should be authenticated.
 * @param timeout Maximum time to wait for a push notification before giving up.
 * @param completionHandler Handler to call when the test has completed. If there was an error or
 *        the test timed out, the error argument will be set. This is always called on the main thread.
 */
- (DOPushNotificationTest *)testWithWebClient:(DOWebClient *)webClient
                                      timeout:(NSTimeInterval)timeout
                            completionHandler:(DOPushNotificationTestHandler)completionHandler;

@end
