var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/// <reference path="../base/BaseClass.ts" />
/// <reference path="../serialization/ISerializable.ts" />
/// <reference path="../net/Uri.ts" />
var econda;
(function (econda) {
    var env;
    (function (env) {
        var Uri = econda.net.Uri;
        /**
         * Represents a single page view. See {@link econda.env.Session} for details.
         * @class econda.env.PageView
         * @experimental
         */
        var PageView = (function (_super) {
            __extends(PageView, _super);
            function PageView(cfg) {
                _super.call(this);
                /**
                 * URI of page
                 * @cfg {econda.net.Uri|String} Uri of page
                 */
                this._uri = null;
                /**
                 * Timestamp when page was loaded
                 * @cfg {Date} timestamp
                 */
                this._timestamp = null;
                /**
                 * In milliseconda
                 */
                this._viewTime = null;
                if (cfg instanceof PageView) {
                    return cfg;
                }
                this.initConfig(cfg);
            }
            PageView.prototype.getUri = function () {
                return this._uri;
            };
            PageView.prototype.setUri = function (uri) {
                this._uri = new Uri(uri);
                return this;
            };
            PageView.prototype.getTimestamp = function () {
                return this._timestamp;
            };
            PageView.prototype.setTimestamp = function (timestamp) {
                this._timestamp = timestamp;
                return this;
            };
            PageView.prototype.getViewTime = function () {
                return this._viewTime;
            };
            PageView.prototype.setViewTime = function (milliseconds) {
                this._viewTime = milliseconds;
                return this;
            };
            /**
             * Return data for serialization
             * @returns {Object}
             */
            PageView.prototype.getObjectData = function () {
                return {
                    className: 'econda.env.PageView',
                    data: {
                        uri: (this._uri ? this._uri.toString() : null),
                        timestamp: this._timestamp,
                        viewTime: this._viewTime
                    }
                };
            };
            PageView.prototype.setObjectData = function (data) {
                if (typeof data === 'object' && data !== null) {
                    this._uri = data.uri || null;
                    this._timestamp = data.timestamp || null;
                    this._viewTime = data.viewTime || null;
                }
            };
            return PageView;
        }(econda.base.BaseClass));
        env.PageView = PageView;
    })(env = econda.env || (econda.env = {}));
})(econda || (econda = {}));