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="AbstractFieldDecorator.ts" />
/// <reference path="../../base/BaseClass.ts" />
/// <reference path="../../util/ArrayUtils.ts" />
var econda;
(function (econda) {
    var recengine;
    (function (recengine) {
        var decorator;
        (function (decorator) {
            var ArrayUtils = econda.util.ArrayUtils;
            /**
             * Arrange the product items of the response list in random order.
             * @class econda.recengine.decorator.ProductListRandomizer
             */
            var ProductListRandomizer = (function (_super) {
                __extends(ProductListRandomizer, _super);
                function ProductListRandomizer(cfg) {
                    if (cfg === void 0) { cfg = null; }
                    _super.call(this);
                    /**
                     * Reference to request object
                     * @cfg {econda.recengine.Request} request
                     * @accessor
                     */
                    this.request = null;
                    if (cfg instanceof ProductListRandomizer) {
                        return cfg;
                    }
                    this.initConfig(cfg);
                }
                ProductListRandomizer.prototype.getRequest = function () {
                    return this.request;
                };
                ProductListRandomizer.prototype.setRequest = function (request) {
                    this.request = request;
                    return this;
                };
                ProductListRandomizer.prototype.decorate = function (response) {
                    var products = response.getProducts();
                    ArrayUtils.shuffle(products);
                };
                return ProductListRandomizer;
            }(econda.base.BaseClass));
            decorator.ProductListRandomizer = ProductListRandomizer; // end of class
        })(decorator = recengine.decorator || (recengine.decorator = {}));
    })(recengine = econda.recengine || (econda.recengine = {}));
})(econda || (econda = {})); // end of module