/**
 * @fileOverview This file contains the Collections pertaining to the Radio 
 * @author Jacob Fierro
 */


 /*=========================================
	TRACKS
==========================================*/

VV.Radio.Collections.Tracks = Backbone.Collection.extend({
 	model : VV.Radio.Models.Track,
 	url : "js/tracks.json",

 	initialize : function() {
 		// trackId's are 1 based
 	},

 	/**
 	* Remember: track id's are 1 based
 	*/
 	getNextTrackId : function(currentTrackId) {
 		return (currentTrackId === this.length) ? 1 : currentTrackId += 1;
 	},

 	/**
 	* This is not a 'history', you're just jumping back one spot in the list
 	* trackId's are 1 based
 	*/
 	getPreviousTrackId : function(currentTrackId) {
 		return (currentTrackId === 1) ? this.length : currentTrackId -= 1;
 	},

 	/**
 	* Gives the path/file for the given trackId
 	* @returns {String}
 	*/
 	getTrackPath : function(trackId) {
 		var path = "";
 		this.each(function( track ) {
			if ( track.get('trackId') === trackId ) {
				path = track.get('file_path');
			}
		});
		return path;
 	}
});
