sap.ui.define([
	"sap/suite/ui/generic/template/genericUtilities/controlStateWrapperFactory/SmartTableChartCommon"
], function(SmartTableChartCommon) {
	"use strict";

	/**
	 * Constructor for SmartTableWrapper
	 * @param {sap.ui.comp.smarttable.SmartTable} oSmartTable - The SmartTable control
	 * @param {object} oController - The controller instance
	 * @param {object} oFactory - The ControlStateWrapperFactory instance
	 * @returns {object} Wrapper object for SmartTable
	 */
	function SmartTableWrapper(oSmartTable, oController, oFactory){
		// SmartTable extends SmartTableChartCommon with tableSettings support
		return new SmartTableChartCommon(oSmartTable, oController, oFactory, "initialise", {
			// Extension to add tableSettings to the state
			fnExtendGetUiState: function(oStateUiState, oControlUiState) {
				oStateUiState.oTableSettings = oControlUiState.getTableSettings();
			},
			// Extension to apply tableSettings from the state
			fnExtendSetUiState: function(oStateUiState, oControlUiState) {
				if (oStateUiState.oTableSettings) {
					oControlUiState.setTableSettings(oStateUiState.oTableSettings);
				}
			}
		});
	}

	return SmartTableWrapper;
});
