 import MetabolicCompassKit
 import SwiftDate
 import Async
+import AwesomeCache
 
 @objc protocol DailyChartModelProtocol {
     optional func dataCollectingFinished()
     optional func dailyProgressStatCollected()
 }
 
+class DailyProgressDayInfo: NSObject, NSCoding {
+    
+    static var dayColorsKey = "dayColors"
+    static var dayValuesKey = "dayValues"
+    
+    internal var dayColors: [UIColor] = [UIColor.clearColor()]
+    internal var dayValues: [Double] = [24.0]
+    
+    init(colors: [UIColor], values: [Double]) {
+        self.dayColors = colors
+        self.dayValues = values
+    }
+    
+    required internal convenience init?(coder aDecoder: NSCoder) {
+        guard let colors = aDecoder.decodeObjectForKey(DailyProgressDayInfo.dayColorsKey) as? [UIColor] else { return nil }
+        guard let values = aDecoder.decodeObjectForKey(DailyProgressDayInfo.dayValuesKey) as? [Double] else { return nil }
+        self.init(colors: colors, values: values)
+    }
+    
+    internal func encodeWithCoder(aCoder: NSCoder) {
+        aCoder.encodeObject(dayColors, forKey: DailyProgressDayInfo.dayColorsKey)
+        aCoder.encodeObject(dayValues, forKey: DailyProgressDayInfo.dayValuesKey)
+    }
+}
+
+typealias MCDaylyProgressCache = Cache<DailyProgressDayInfo>
+
 class DailyChartModel : NSObject, UITableViewDataSource {
+
     /// initializations of these variables creates offsets so plots of event transitions are square waves
     private let stWorkout = 0.0
     private let stSleep = 0.33

    var lastAteText: String = ""
    var eatingText: String = ""
    var daysTableView: UITableView?
    
    var daysArray: [NSDate] = {
        var lastSevenDays: [NSDate] = []


    private let dayCellIdentifier = "dayCellIdentifier"
    private let emptyValueString = "- h - m"
    
    var cachedDailyProgress: MCDaylyProgressCache
    
    var delegate:DailyChartModelProtocol? = nil
    var chartDataArray: [[Double]] = []
