define([], function() {
'use strict';
/**
* Describes the root top-level ABCS page view model.
*
* Each ABCS page binds its view to an instance of generated <code>PageViewModel</code>
* representing the root page view model. ABCS uses {@link http://knockoutjs.com/documentation/introduction.html knockout} to bind
* HTML view t its model.
*
* The model consists of higher constructs such as page {@link viewmodel/js/api/Archetype Archetypes},
* Business Objects ({@link entity/js/api/Entity Entities}) the page works with
* and generated Business Methods used on the page.
*
* Page view model instance:
* <ul>
* <li>is accessible as <code>$root</code> context inside the DOM generated
* for the page</li>
* <li>passed as <code>self</code> into Custom JS Business Action code blocks</li>
* <li>passed as <code>params.root</code> into Custom Code component view model</li>
* </ul>
*
* @AbcsAPI stable
* @exports viewmodel/js/api/PageViewModel
* @constructor
* @private
* @version 16.3.5
*
* @example <caption>Pass page view model into custom ko component's model</caption>
* <my-custom-component params="{
* pageViewModel: $root
* }"></my-custom-component>
* @example <caption>List page Business Objects in custom component's model</caption>
* var MyCustomComponentModel = function (params) {
* // params.pageViewModel contains reference to the page view model
* // as the previous example demonstrates
* var pageViewModel = params.pageViewModel;
*
* // build list of all BO names used on the page
* var entities = pageViewModel.Entities;
* var message = 'Page contains Business Objects: ';
* message = message +
* Object.keys(entities).map(function (entityId) {
* return entities[entityId].getName();
* }).join(', ');
*
* // set the message into a ko observable to be bindable in your
* // component's HTML view
* this.message = ko.observable(message);
* };
*/
var PageViewModel = function() {
};
/**
* Map of all {@link viewmodel/js/api/Archetype archetypes} used on the page
* identified by their ids.
*
* <strong>Note that</strong> particular archetypes may not be forever present
* on a page. As their owner component (such as table, list or a form) may be
* removed from the page, so may the archetype be removed along with it. Hence
* you should always check for the archetype's existence before using it.
*
* @AbcsAPI stable
* @version 16.3.5
* @type {Object<String, viewmodel/js/api/Archetype>}
*/
PageViewModel.prototype.Archetypes = {};
/**
* Map of all Business Objects ({@link entity/js/api/Entity Entities}) used
* by page archetypes identified by their ids.
*
* @AbcsAPI stable
* @version 16.3.5
* @type {Object<String, entity/js/api/Entity>}
*/
PageViewModel.prototype.Entities = {};
/**
* Map of all observables objects provided by page archetypes. Contains all
* objects returned by {@link viewmodel/js/api/Archetype#getObservables Archetype.getObservables}
* identified by {@link viewmodel/js/api/Archetype#getId archetype ids}.<br>
* So <code>pageViewModel.Observables.customerTableArchetypeId</code>
* is a shortcut for <code>pageViewModel.Archetypes.customerTableArchetypeId.getObservables</code>.
*
* @AbcsAPI stable
* @version 16.3.5
* @type {Object<String, Object>}
* @see {@link viewmodel/js/api/Archetype#getObservables Archetype.getObservables}
*/
PageViewModel.prototype.Observables = {};
/**
* Initialize page using given contextual data. This method is always called
* after first creation of the page.
*
* @param {ContextualData} contextualData
*/
PageViewModel.prototype.create = function(/*contextualData*/) {
};
/**
* Update existing page using contextual data. When applicaito navigation is
* returning to previous opened page this method is called instead create().
*
* @param {ContextualData} contextualData
*/
PageViewModel.prototype.update = function(/*contextualData*/) {
};
/**
* Returns textual short representation of this page which can be used to
* bookmark this page. Reopening page fromj bookmark will result in this
* string being passed into above create method using contextual data of
* type Bookmark.
*
* @returns {String}
*/
PageViewModel.prototype.getBookmark = function() {
};
/**
* Returns display name of the page.
* <p>
* This information is leveraged in the browser's TITLE in the generated
* application and can be uptaken by components of the page.
*
* @returns {String}
*/
PageViewModel.prototype.getDisplayName = function() {
};
return PageViewModel;
});