 //
//  Database+Trips.h
//  DrivoMeter
//
//

#import "Database.h"

@class Trip;
@class Period;
@class Favorite;
@interface Database (Trips)

- (Trip *)startCurrentTrip;
- (void)endTrip:(Trip *)trip withDistance:(double)distance purpose:(NSString *)purpose;
- (Trip *)addTripWithDistance:(double)dist endState:(double)state isBusiness:(BOOL)business date:(NSDate *)date purpose:(NSString *)purpose;
- (void)addTripWithDistance:(double)dist endState:(double)state isBusiness:(BOOL)business date:(NSDate *)date purpose:(NSString *)purpose favorite:(Favorite *)favorite;
- (void)cancelTrip:(Trip *)trip;

- (NSArray *)listTripsFrom:(NSDate *)begin to:(NSDate *)end;
- (void)deleteTrip:(Trip *)trip;
- (void)deleteAllTrips;

- (NSFetchedResultsController *)fetchedResultsControllerForAllTrips;
- (NSFetchedResultsController *)fetchedResultsControllerForTripsInRangeFrom:(NSDate *)begin to:(NSDate *)end;
- (void)updateFetchedResultsController:(NSFetchedResultsController *)controller withPeriod:(Period *)period;

@end
