/* Copyright 2009 Palm, Inc.  All rights reserved. */

Photos.Model.Fullscreen = Class.create(Photos.Model.Scene, {
	initialize: function(albumID, albumName, index) {
		this.albumID = albumID;
		this.albumName = albumName;
		this.index = -1;
		this.desiredIndex = index;
		this.total = 0;
		this._centerCB = function(){};
		this._leftCB = function(){};
		this._rightCB = function(){};
	},

	aboutToAcitvate: function() {
	},

	setCallbacks: function(centerCB, leftCB, rightCB) {
		this._centerCB = centerCB;
		this._leftCB = leftCB;
		this._rightCB = rightCB;
	},

	cleanup: function() {
	},

	getName: function(callback) {
		if (this.albumName) {
			callback(this.albumName);
		} else {
			this.nameUpdate = callback;
		}
	},

	headerTapped: function(stageController) {
		stageController.popScene();
	},

	// Mandatory callbacks for the ImageFlipView widget ==============
	goLeft: function() {
		return this.jumpTo(this.index - 1);
	},

	goRight: function() {
		return this.jumpTo(this.index + 1);
	},

	jumpTo: function(newIndex) {
		var i = parseInt(newIndex, 10);
		if (i < 0) {
			return false;
		} else if (i >= this.getTotal()) {
			return false;
		} else if (i === this.index) {
			return false;
		}
		this.index = i;
		this.runCallbacks();
		return true;
	},

	idleStart: function() {
	},

	idleStop: function() {
	},

	getIndex: function() {
		return this.index;
	},

	getTotal: function() {
		return this.total;
	},

	runCallbacks: function() {
		return;
	},

	// Implies that remove is available and will be called for a delete.
	// when the callbacks have been updated, after a remove, the spinner
	// will be removed.
	canRemove: function() {
		return false;
	},
	
	// call callback(text) with a string to put into the description
	// of the photo at the top of the fullscreen view.
	getDescription: function(callback) {
	},

	remove: function(offset) {
		return false;
	},

	// File must be local and you should have permissions before enabling
	// this functionality.
	canAssignToContact: function() {
		return false;
	},

	canShareFamily: function() {
		return false;
	},

	canSetWallpaper: function() {
		return false;
	},

	canEmail: function() {
		return false;
	},

	canMMS: function() {
		return false;
	},

	canComment: function() {
		return false;
	},

	canUpload: function() {
		return false;
	},

	// returns the scene name that will be used for popping back to
	// in the event the last fullscreen item has been removed.
	//
	// In the remove you could also provide an empty album picture
	// as a center callback and disable remove functionality for that image
	emptyScene: function() {
		return "home";
	}
});

