//
//  DOWebPublishedEntry.h
//  DOCore
//
//  Created by Ben Dolman on 5/14/13.
//
//

#import "DOWebObject.h"
#import "DOWebPublishWeather.h"
#import "DOWebPublishLocation.h"
#import "DOJournalEntryFile.h"
#import "DOWebPublication.h"
#import "DOWebPublishDate.h"
#import "DOWebPublishEditRecord.h"

@interface DOWebPublishedEntry : DOWebObject <MTLManagedObjectSerializing>

@property (nonatomic, copy) NSString *publishID;
@property (nonatomic, copy) NSNumber *ownerID;
@property (nonatomic, copy) NSString *legacyID;
@property (nonatomic, copy) NSString *clientChecksum;

@property (nonatomic, strong) DOWebPublishDate *date;

@property (nonatomic, strong) DOWebPublishEditRecord *creation;
@property (nonatomic, strong) DOWebPublishEditRecord *edit;

@property (nonatomic, copy) NSString *body;
@property (nonatomic, assign, getter = isStarred) BOOL starred;
@property (nonatomic, copy) NSArray *tags;
@property (nonatomic, assign, getter = isDeleted) BOOL deleted;

// Array of DOWebPublishFile objects
@property (nonatomic, copy) NSArray *files;

@property (nonatomic, strong) DOWebPublishLocation *location;
@property (nonatomic, strong) DOWebPublishWeather *weather;
@property (nonatomic, strong) DOWebPublication *publication;

/**
 * Initializes the object with the contents of the entry file.
 * Returns nil if entryFile is nil.
 */
- (id)initWithEntryFile:(DOJournalEntryFile *)entryFile;

/**
 * Overwrites relevant fields with the values in the entry file
 */
- (void)updateWithEntryFile:(DOJournalEntryFile *)entryFile;

@end