 import FlatUIColors
 
 class AATrickViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
-    
     let cellReuseID:String = "cellReuseID"
+
+    var voteTally = [Int:Bool]()
     private let numCols = 4
     private let numRows = 8
     let deck = AATDeckModel.sharedDeck
 
+    enum ButtonCellRow:Int {
+        case YesButton = 30
+        case NoButton  = 31
+    }
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         
         deck.resetDeck()
         var card1 = produceCardView()
         
-
+        /**
+        TODO: Refactor deck, load all at once.
+        */
 
         /**
         TODO NEXT: 

        collectionView.dataSource = self
        collectionView.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier:cellReuseID)
        collectionView.backgroundColor = FlatUIColors.randomFlatColor()
        return collectionView
    }
    
    // MARK: === UICollectionView dataSource ===
    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return numCols * numRows
    }

        return String(topCard[indexPath.row])
    }
    
    func vote(vote:Bool) {
        if let cardValue = deck.topCard?.first {
            voteTally[cardValue] = vote
        }
        //???: Check win conditions here?
        print(voteTally)
    }
    
    //ViewController Ends here
}

extension FlatUIColors {
    public static func randomFlatColor()->UIColor {
        let colors = [FlatUIColors.turquoiseColor(), FlatUIColors.greenSeaColor(), FlatUIColors.emeraldColor(), FlatUIColors.nephritisColor(), FlatUIColors.peterRiverColor(), FlatUIColors.belizeHoleColor(), FlatUIColors.amethystColor(), FlatUIColors.wisteriaColor(), FlatUIColors.wetAsphaltColor(), FlatUIColors.midnightBlueColor(), FlatUIColors.sunflowerColor(), FlatUIColors.flatOrangeColor(), FlatUIColors.carrotColor(), FlatUIColors.pumpkinColor(), FlatUIColors.alizarinColor(), FlatUIColors.pomegranateColor(), FlatUIColors.cloudsColor(), FlatUIColors.silverColor(), FlatUIColors.concreteColor(), FlatUIColors.asbestosColor()]
        
        let randomIndex:Int = Int(arc4random_uniform(UInt32(colors.count)))
        return colors[randomIndex]
    }
    
    public static func flatOrangeColor(alpha: CGFloat = 1.0) -> OSColor! {return UIColor(red: 243, green: 156, blue: 18, alpha: alpha)}
    
    public static func randomFlatColorPair()->(UIColor, UIColor) {
        let colorPairs:[(colorA:UIColor, colorB:UIColor)] =
        [(FlatUIColors.turquoiseColor(), FlatUIColors.greenSeaColor()),
            (FlatUIColors.emeraldColor(), FlatUIColors.nephritisColor()),
            (FlatUIColors.peterRiverColor(), FlatUIColors.belizeHoleColor()),
            (FlatUIColors.amethystColor(), FlatUIColors.wisteriaColor()),
            (FlatUIColors.wetAsphaltColor(), FlatUIColors.midnightBlueColor()),
            (FlatUIColors.sunflowerColor(), FlatUIColors.flatOrangeColor()),
            (FlatUIColors.carrotColor(), FlatUIColors.pumpkinColor()),
            (FlatUIColors.alizarinColor(), FlatUIColors.pomegranateColor()),
            (FlatUIColors.cloudsColor(), FlatUIColors.silverColor()),
            (FlatUIColors.concreteColor(), FlatUIColors.asbestosColor())
        ]
        let randomIndex:Int = Int(arc4random_uniform(UInt32(colorPairs.count)))
        return colorPairs[randomIndex]
    }
}

