
var ModelIface = require ('./object');

/**
 * Monitorizes all changes made to a model.
 */
var Klass = new Class ();
module.exports = Klass;

var Mode =
{
	 ON_CHANGE : 1
	,ON_DEMAND : 2
};

var Operation =
{
	 INSERT : 1 << 1
	,UPDATE : 1 << 2
	,DELETE : 1 << 3
};

Klass.extend
({
	 Mode: Mode
	,Operation: Operation
});

Klass.implement
({
	Implements: ModelIface
	,Properties:
	{
		/**
		 * Update mode.
		 */
		mode:
		{
			enumType: Mode
			,value: Mode.ON_CHANGE
		}
	}

	/**
	 * Updates a value on the model.
	 *
	 * @param {number} rowIndex The row index
	 * @param {string} columnName The column name
	 * @param {*} value The new value
	 */
	,set: function () {}

	/**
	 * Updates a value on the model using the column index.
	 *
	 * @param {number} rowIndex The row index
	 * @param {number} col The column index
	 * @param {*} value The new value
	 */
	,setByIndex: function () {}

	/**
	 * Deletes a row from the model. 
	 *
	 * @param {number} rowIndex The row index
	 */
	,deleteRow: function () {}

	/**
	 * Inserts a new row on the model.
	 *
	 * @return The index of the inserted row
	 */
	,insertRow: function () {}

	/**
	 * Cleans the model data.
	 */
	,clean: function () {}
	
	/**
	 * Performs all model changes on the database.
	 */
	,performOperations: function () {}
});

