//
//  documentFile.m
//  AS350B3e
//
//  Created by KulanaMac on 2/21/15.
//
//

#import "documentFile.h"

@implementation documentFile

@synthesize filename;
@synthesize downloaded;
@synthesize lastupdate;


-(id) initWithFilename:(NSString*)theFilename AndLastupdate:(int)theLastupdate AndDownloaded:(int)theDownloaded;
{
    filename=theFilename;
    downloaded=theDownloaded;
    lastupdate=theLastupdate;
    return self;
}

- (id) initWithCoder: (NSCoder *)coder
{
    if (self = [super init])
    {
        self.filename = [coder decodeObjectForKey:@"filename"];
        self.downloaded = [[coder decodeObjectForKey:@"downloaded"] intValue];
        self.lastupdate = [[coder decodeObjectForKey:@"lastupdate"] intValue];
    }
    return self;
}

- (void) encodeWithCoder: (NSCoder *)coder
{
    [coder encodeObject:filename forKey:@"filename"];
    [coder encodeObject:[NSString stringWithFormat:@"%i",downloaded] forKey:@"downloaded"];
    [coder encodeObject:[NSString stringWithFormat:@"%i",lastupdate] forKey:@"lastupdate"];
    
}


-(void) setDownloaded {
    self.downloaded=1;
}

-(void) unsetDownloaded {
    self.downloaded=0;
}

-(void) setLastupdate:(int)theLastupdate {
    lastupdate=theLastupdate;
}


@end
