//
//  DOTodayEntriesManager.h
//  DOCore
//
//  Created by Joshua Orr on 9/22/14.
//
//

#import <Foundation/Foundation.h>
#import "DOTodayEntries.h"

@class DOTodayEntriesManager;

@protocol DOTodayEntriesManagerDelegate <NSObject>

@required
- (NSDate *)journalLastModifiedDateForTodayEntriesManager:(DOTodayEntriesManager *)manager;

@end



//! Used by today extension to get entry slot data.
@interface DOTodayEntriesManager : NSObject

//! Gives back a new DOTodayEntriesManager with context/slot factory.  Defaults to users current localized calendar.
//! Will pass back DOTodayEntriesManager.
+ (instancetype)managerWithContext:(NSManagedObjectContext *)context;

//! Gives back a new DOTodayEntriesManager with context/slot factory.  Defaults to users current localized calendar.
+ (instancetype)managerWithContext:(NSManagedObjectContext *)context delegate:(id<DOTodayEntriesManagerDelegate>)delegate;

@property (nonatomic, weak) id<DOTodayEntriesManagerDelegate> delegate;
@property NSCalendar *calendar;

- (DOTodayEntries *)todayEntries;

//! Earliest entry in entire journal.
- (DOEntry *)oldestEntry;

- (void)countEntriesByDayForNumberOfPastDays:(NSInteger)numberOfPastDays completion:(void(^)(NSArray *counts))completion;
- (void)countPhotosByDayForNumberOfPastDays :(NSInteger)numberOfPastDays completion:(void(^)(NSArray *counts))completion;
- (void)countWordsByDayForNumberOfPastDays  :(NSInteger)numberOfPastDays completion:(void(^)(NSArray *counts))completion;

@end
