//
//  DOTimedQueue.h
//  DOCore
//
//  Created by Ben Dolman on 8/13/14.
//
//

#import <Foundation/Foundation.h>

@protocol DOTimedQueueDelegate;

/**
 * Schedules items to be fired at a particular time. Useful for things like retry queues
 */
@interface DOTimedQueue : NSObject

@property (weak) id<DOTimedQueueDelegate>delegate;
@property (assign, readonly) NSUInteger count;
@property (assign, getter=isSuspended) BOOL suspended;

- (void)fireItem:(id)item afterDelay:(NSTimeInterval)delay;
- (void)fireAllItemsNow;

- (NSDate *)fireDateForItem:(id)item;
- (void)cancelItem:(id)item;
- (void)cancelAllItems;

@end


@protocol DOTimedQueueDelegate <NSObject>

- (void)timedQueue:(DOTimedQueue *)queue handleItem:(id)item;

@end
