#import <Foundation/Foundation.h>
#import <sqlite3.h>

#define kTuneUnknown 0
#define kTuneReel 1
#define kTuneJig 2
#define kTunePolka 3
#define kTuneWaltz 4
#define kTuneAir 5

@interface Tune : NSObject {
    sqlite3 *database;
    NSInteger primaryKey;
    NSString *title;
    NSString *dots;
    BOOL hydrated;
    BOOL dirty;
    NSData *data;
    char rating;
    NSString *key;
    char numSharps;
    char timeSigNum;
    char timeSigDen;
}

@property (assign, nonatomic, readonly) NSInteger primaryKey;
@property (copy, nonatomic) NSString *title;
@property (copy, nonatomic) NSString *dots;

@property (copy, nonatomic) NSString *key;
@property (nonatomic) char numSharps;
@property (nonatomic) char timeSigNum;
@property (nonatomic) char timeSigDen;
@property (nonatomic) char rating;

+ (void)finalizeStatements;

- (id)initWithPrimaryKey:(NSInteger)pk database:(sqlite3 *)db;
- (void)insertIntoDatabase:(sqlite3 *)database;

- (void)hydrate;
- (void)dehydrate;
- (void)deleteFromDatabase;

- (BOOL)dirty;

- (void)setKeySignature:(char) k sharps:(char)n;
- (void)setTimeSignature:(int)num denominator:(int)denom;

@end
