"use strict";
/**
 * Tests RatingService
 *
 *  Copyright (C) 2010-2019 R-T Specialty, LLC.
 *
 *  This file is part of the Liza Data Collection Framework.
 *
 *  liza is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var RatingService_1 = require("../../../src/server/service/RatingService");
var QuoteDataBucket_1 = require("../../../src/bucket/QuoteDataBucket");
var chai_1 = require("chai");
chai_1.use(require('chai-as-promised'));
describe('RatingService', function () {
    it('returns rating results', function () {
        var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        var expected = {
            content: {
                data: stub_rate_data,
                initialRatedDate: quote.getRatedDate(),
                lastRatedDate: quote.getLastPremiumDate(),
            },
            actions: [],
        };
        return chai_1.expect(sut.request(session, quote, '')).to.eventually.deep.equal(expected);
    });
    it('returns previous rating results when rating is not performed', function () {
        var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var last_premium_date_call_count = 0;
        var initial_date_call_count = 0;
        var initial_date = 2345;
        var cur_date = Math.round(new Date().getTime() / 1000);
        // setup recent last prem date to ensure quote is valid
        quote.getLastPremiumDate = function () {
            last_premium_date_call_count++;
            return cur_date;
        };
        quote.getRatedDate = function () {
            initial_date_call_count++;
            return initial_date;
        };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function (result) {
            chai_1.expect(result.content.initialRatedDate).to.equal(initial_date);
            chai_1.expect(result.content.lastRatedDate).to.equal(cur_date);
            chai_1.expect(result.content.data).to.equal(stub_rate_data);
            chai_1.expect(last_premium_date_call_count).to.equal(2);
            chai_1.expect(initial_date_call_count).to.equal(1);
        });
    });
    it('Invalidates a quote with a meta bucket updated after last rate', function () {
        var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var last_premium_date_call_count = 0;
        var initial_date_call_count = 0;
        var initial_date = 2345;
        var cur_date = Math.round(new Date().getTime() / 1000);
        // setup recent last prem date to ensure quote is valid
        quote.getLastPremiumDate = function () {
            last_premium_date_call_count++;
            return cur_date;
        };
        quote.getRatedDate = function () {
            initial_date_call_count++;
            return initial_date;
        };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function (result) {
            chai_1.expect(result.content.initialRatedDate).to.equal(initial_date);
            chai_1.expect(result.content.lastRatedDate).to.equal(cur_date);
            chai_1.expect(result.content.data).to.equal(stub_rate_data);
            chai_1.expect(last_premium_date_call_count).to.equal(2);
            chai_1.expect(initial_date_call_count).to.equal(1);
        });
    });
    it('updates rating dates before serving to client', function () {
        var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        var last_prem_called = false;
        var rated_date_called = false;
        var stub_last_prem_ts = 0;
        var stub_rated_date_ts = 0;
        quote.setLastPremiumDate = function () {
            last_prem_called = true;
            return quote;
        };
        quote.setRatedDate = function () {
            rated_date_called = true;
            return quote;
        };
        quote.getLastPremiumDate = function () { return stub_last_prem_ts; };
        quote.getRatedDate = function () { return stub_rated_date_ts; };
        var expected = {
            content: {
                data: stub_rate_data,
                initialRatedDate: stub_rated_date_ts,
                lastRatedDate: stub_last_prem_ts,
            },
            actions: [],
        };
        return chai_1.expect(sut.request(session, quote, ''))
            .to.eventually.deep.equal(expected)
            .then(function (result) {
            chai_1.expect(result.content.initialRatedDate).to.equal(stub_rated_date_ts);
            chai_1.expect(result.content.lastRatedDate).to.equal(stub_last_prem_ts);
            chai_1.expect(last_prem_called).to.be.true;
            chai_1.expect(rated_date_called).to.be.true;
        });
    });
    it('sets last premium date to zero if there was an override', function () {
        var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var rater = new (/** @class */ (function () {
            function class_1() {
            }
            class_1.prototype.rate = function (_quote, _session, _indv, success, _failure) {
                // force to be async so that the tests resemble how the code
                // actually runs
                process.nextTick(function () { return success(stub_rate_data, [], true); });
                return this;
            };
            return class_1;
        }()))();
        raters.byId = function (_) { return rater; };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        var last_prem_called = false;
        var rated_date_called = false;
        var stub_last_prem_ts = 123;
        var stub_rated_date_ts = 2592001;
        quote.setLastPremiumDate = function (ts) {
            stub_last_prem_ts = ts;
            last_prem_called = true;
            return quote;
        };
        quote.setRatedDate = function (ts) {
            stub_rated_date_ts = ts;
            rated_date_called = true;
            return quote;
        };
        quote.getLastPremiumDate = function () { return stub_last_prem_ts; };
        quote.getRatedDate = function () { return stub_rated_date_ts; };
        var expected = {
            content: {
                data: stub_rate_data,
                initialRatedDate: stub_rated_date_ts,
                lastRatedDate: 0,
            },
            actions: [],
        };
        return chai_1.expect(sut.request(session, quote, '', true))
            .to.eventually.deep.equal(expected)
            .then(function (_) {
            chai_1.expect(last_prem_called, 'baz').to.be.true;
            chai_1.expect(rated_date_called, 'baax').to.be.true;
        });
    });
    it('saves rate data to its own field', function () {
        var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var saved_rates = false;
        var saveQuote_call_count = 0;
        dao.saveQuote = function (quote, success, _failure, save_data, _push_data) {
            chai_1.expect(save_data.ratedata).to.deep.equal(stub_rate_data);
            saveQuote_call_count++;
            saved_rates = true;
            success(quote);
            return dao;
        };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function () {
            chai_1.expect(saved_rates).to.be.true;
            chai_1.expect(saveQuote_call_count).to.equal(1);
        });
    });
    it('saves delta to its own field', function () {
        var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, stub_rate_delta = _a.stub_rate_delta, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var saved_quote = false;
        var timestamp = 0;
        quote.setLastPremiumDate = function (ts) {
            timestamp = ts;
            return quote;
        };
        var saveQuote_call_count = 0;
        dao.saveQuote = function (quote, success, _failure, _save_data, push_data) {
            stub_rate_delta['rdelta.ratedata'].timestamp = timestamp;
            saved_quote = true;
            chai_1.expect(push_data).to.deep.equal(stub_rate_delta);
            saveQuote_call_count++;
            success(quote);
            return dao;
        };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function () {
            chai_1.expect(saved_quote).to.be.true;
            chai_1.expect(saveQuote_call_count).to.equal(1);
        });
    });
    it('rejects and responds with error', function () {
        var _a = getStubs(), dao = _a.dao, logger = _a.logger, program = _a.program, quote = _a.quote, rater = _a.rater, raters = _a.raters, session = _a.session, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var expected_error = new Error('expected error');
        rater.rate = function () {
            throw expected_error;
        };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        var logged = false;
        logger.log = function (priority, _format, qid, program_id, message) {
            if (typeof message === 'string') {
                chai_1.expect(priority).to.equal(logger.PRIORITY_ERROR);
                chai_1.expect(qid).to.equal(quote.getId());
                chai_1.expect(program_id).to.equal(program.getId());
                chai_1.expect(message).to.contain(expected_error.message);
                logged = true;
            }
            return logger;
        };
        return chai_1.expect(sut.request(session, quote, ''))
            .to.eventually.rejectedWith(expected_error)
            .then(function () { return chai_1.expect(logged).to.be.true; });
    });
    it('returns error message from rater', function () {
        var _a = getStubs(), dao = _a.dao, logger = _a.logger, quote = _a.quote, rater = _a.rater, raters = _a.raters, session = _a.session, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var expected_message = 'expected foo';
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        rater.rate = function (_quote, _session, _indv, _success, failure) {
            failure(expected_message);
            return rater;
        };
        return chai_1.expect(sut.request(session, quote, '')).to.eventually.rejectedWith(Error, expected_message);
    });
    // this means of deferred rating is deprecated and is being superceded
    // in the near future by a better system; it will hopefully be removed
    // at some point
    it('sends indvRate action for old-style deferred suppliers', function () {
        var _a = getStubs(), dao = _a.dao, logger = _a.logger, quote = _a.quote, raters = _a.raters, session = _a.session, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        stub_rate_data._cmpdata = {
            deferred: ['supp1', 'supp2'],
        };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function (result) {
            chai_1.expect(result.actions).to.deep.equal([
                { action: 'indvRate', id: 'supp1' },
                { action: 'indvRate', id: 'supp2' },
            ]);
        });
    });
    it('Consider missing retry flag to still be pending', function () {
        var _a = getStubs(), dao = _a.dao, logger = _a.logger, quote = _a.quote, raters = _a.raters, session = _a.session, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        // The stub rate data returned on rate has a total of 1 supplier and
        // we are specifying that there are no retry fields, so one must be
        // missing. Missing retry attempts should be treated as pending so we
        // expect the retry attempt counter to be incremented
        var total_retry_fields = 1;
        var retry_attempts_current = 12;
        var retry_attempts_expected = 13;
        var retry_attempts_given;
        quote.setRetryAttempts = function (attempts) {
            retry_attempts_given = attempts;
            return quote;
        };
        quote.getRetryCount = function () {
            return {
                field_count: total_retry_fields,
                true_count: 0,
            };
        };
        quote.getRetryAttempts = function () { return retry_attempts_current; };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function (result) {
            // Expect that the missing field was added in once retries were
            // cleared. The id from the stub rate data is foo
            chai_1.expect(result.content.data['foo___retry']).to.deep.equal([0]);
            chai_1.expect(retry_attempts_given).to.equal(retry_attempts_expected);
        });
    });
    it('Ignore missing retry flag logic if no retry flags exist', function () {
        var _a = getStubs(), dao = _a.dao, logger = _a.logger, quote = _a.quote, raters = _a.raters, session = _a.session, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        // The stub rate data returned on rate has a total of 1 supplier and
        // we are specifying that there are no retry fields, so one must be
        // missing. Missing retry attempts should be treated as pending so we
        // expect the retry attempt counter to be incremented
        var total_retry_fields = 0;
        var retry_attempts_current = 12;
        var retry_attempts_expected = 0;
        var retry_attempts_given;
        quote.setRetryAttempts = function (attempts) {
            retry_attempts_given = attempts;
            return quote;
        };
        quote.getRetryCount = function () {
            return {
                field_count: total_retry_fields,
                true_count: 0,
            };
        };
        quote.getRetryAttempts = function () { return retry_attempts_current; };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function (_) {
            chai_1.expect(retry_attempts_given).to.equal(retry_attempts_expected);
        });
    });
    it('Default to retry field count if __result_ids is undefined', function () {
        var rate_data = {};
        var _a = getStubs(rate_data), dao = _a.dao, logger = _a.logger, quote = _a.quote, raters = _a.raters, session = _a.session, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
        var retry_attempts_given;
        quote.setRetryAttempts = function (attempts) {
            retry_attempts_given = attempts;
            return quote;
        };
        quote.getRetryCount = function () {
            return {
                field_count: 0,
                true_count: 0,
            };
        };
        var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
        return sut.request(session, quote, '').then(function (_) {
            // Because there were no missing fields and zero true retries returned
            // we will expect the retry attempts to be cleared because there are no
            // more pending
            chai_1.expect(retry_attempts_given).to.equal(0);
        });
    });
    [
        [
            'delay action is returned when raters are pending',
            {
                'supplier-a__retry': [0],
                'supplier-b__retry': [1],
                'supplier-c__retry': [1],
                'supplier-d__retry': [0],
            },
            2,
            [2],
            true,
            [true],
            0,
            0,
            true,
        ],
        [
            'delay action is not returned when all raters are completed',
            {
                'supplier-a__retry': [0],
                'supplier-b__retry': [0],
                'supplier-c__retry': [0],
                'supplier-d__retry': [[0]],
            },
            0,
            [0],
            false,
            [true],
            0,
            0,
            true,
        ],
        [
            'Undefined ratesteps defaults gracefully',
            {
                'supplier-a__retry': [0],
                'supplier-b__retry': [0],
                'supplier-c__retry': [1],
                'supplier-d__retry': [1],
            },
            2,
            [2],
            false,
            undefined,
            0,
            2,
            false,
        ],
        [
            'Set __rate_pending to zero after max attempts are reached',
            {
                'supplier-a__retry': [0],
                'supplier-b__retry': [0],
                'supplier-c__retry': [1],
                'supplier-d__retry': [1],
            },
            2,
            [0],
            false,
            undefined,
            0,
            30,
            false,
        ],
    ].forEach(function (_a) {
        var label = _a[0], supplier_data = _a[1], retry_count = _a[2], expected_count = _a[3], expected_delay_action = _a[4], rate_steps = _a[5], step_id = _a[6], attempts = _a[7], expected_save_meta = _a[8];
        it(label, function () {
            var _a = getStubs(), dao = _a.dao, logger = _a.logger, quote = _a.quote, raters = _a.raters, session = _a.session, stub_rate_data = _a.stub_rate_data, createDelta = _a.createDelta, program = _a.program, ts_ctor = _a.ts_ctor;
            var meta_save_called = false;
            Object.assign(stub_rate_data, supplier_data);
            if (expected_save_meta) {
                dao.saveQuoteMeta = function (_, data, __, ___) {
                    chai_1.expect(data['liza_timestamp_rate_request']).to.deep.equal([
                        ts_ctor(),
                    ]);
                    meta_save_called = true;
                    return dao;
                };
            }
            else {
                meta_save_called = true;
            }
            program.rateSteps = rate_steps;
            quote.getProgram = function () {
                return program;
            };
            quote.getCurrentStepId = function () {
                return step_id;
            };
            quote.getRetryAttempts = function () {
                return attempts;
            };
            quote.getRetryCount = function () {
                return {
                    field_count: 2,
                    true_count: retry_count,
                };
            };
            var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
            return sut
                .request(session, quote, '')
                .then(function (result) {
                var expected_action = {
                    action: 'delay',
                    seconds: 5,
                    then: {
                        action: 'rate',
                        value: -1,
                    },
                };
                expected_delay_action
                    ? chai_1.expect(result.actions).to.deep.equal([expected_action])
                    : chai_1.expect(result.actions).to.not.equal([expected_action]);
                chai_1.expect(result.content.data['__rate_pending']).to.deep.equal(expected_count);
                if (expected_count === [0]) {
                    supplier_data.forEach(function (datum) {
                        chai_1.expect(datum[0]).to.equal(0);
                    });
                }
            })
                .then(function () { return chai_1.expect(meta_save_called).to.be.true; });
        });
    });
    describe('protected API', function () {
        it('calls #postProcessRaterData after rating before save', function (done) {
            var processed = false;
            var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
            dao.mergeBucket = function () {
                chai_1.expect(processed).to.equal(true);
                done();
                return dao;
            };
            var sut = new (/** @class */ (function (_super) {
                __extends(class_2, _super);
                function class_2() {
                    return _super !== null && _super.apply(this, arguments) || this;
                }
                class_2.prototype.postProcessRaterData = function () {
                    processed = true;
                };
                return class_2;
            }(RatingService_1.RatingService)))(logger, dao, raters, createDelta, ts_ctor);
            sut.request(session, quote, 'something');
        });
        it('calls getLastPremiumDate during #_performRating', function () {
            var getLastPremiumDateCallCount = 0;
            var last_date = 1234;
            var initial_date = 2345;
            var _a = getStubs(), logger = _a.logger, raters = _a.raters, dao = _a.dao, session = _a.session, quote = _a.quote, createDelta = _a.createDelta, ts_ctor = _a.ts_ctor;
            quote.getLastPremiumDate = function () {
                getLastPremiumDateCallCount++;
                return last_date;
            };
            quote.getRatedDate = function () { return initial_date; };
            var sut = new RatingService_1.RatingService(logger, dao, raters, createDelta, ts_ctor);
            return sut
                .request(session, quote, '')
                .then(function (result) {
                chai_1.expect(getLastPremiumDateCallCount).to.equal(2);
                chai_1.expect(result.content.initialRatedDate).to.equal(initial_date);
                chai_1.expect(result.content.lastRatedDate).to.equal(last_date);
            });
        });
    });
});
function getStubs(rate_data) {
    var program_id = 'foo';
    var program = {
        getId: function () { return program_id; },
        ineligibleLockCount: 0,
        rateSteps: [true],
    };
    // rate reply
    var stub_rate_data = rate_data || {
        __result_ids: ['foo', 'bar'],
        _unavailable_all: '0',
    };
    var stub_rate_delta = {
        'rdelta.ratedata': {
            data: {
                _unavailable_all: [undefined],
            },
            concluding_save: false,
            timestamp: 123,
        },
    };
    var createDelta = function (_src, _dest) {
        return stub_rate_delta['rdelta.ratedata']['data'];
    };
    var rater = new (/** @class */ (function () {
        function class_3() {
        }
        class_3.prototype.rate = function (_quote, _session, _indv, success, _failure) {
            // force to be async so that the tests resemble how the code
            // actually runs
            process.nextTick(function () { return success(stub_rate_data, []); });
            return this;
        };
        return class_3;
    }()))();
    var raters = {
        byId: function () { return rater; },
    };
    var logger = new (/** @class */ (function () {
        function class_4() {
            this.PRIORITY_ERROR = 0;
            this.PRIORITY_IMPORTANT = 1;
            this.PRIORITY_DB = 2;
            this.PRIORITY_INFO = 3;
            this.PRIORITY_SOCKET = 4;
        }
        class_4.prototype.log = function (_priority) {
            var _args = [];
            for (var _i = 1; _i < arguments.length; _i++) {
                _args[_i - 1] = arguments[_i];
            }
            return this;
        };
        return class_4;
    }()))();
    var dao = new (/** @class */ (function () {
        function class_5() {
        }
        class_5.prototype.saveQuote = function (quote, success, _failure, _save_data, _push_data) {
            success(quote);
            return this;
        };
        class_5.prototype.mergeBucket = function (_, __, cb) {
            cb();
            return this;
        };
        class_5.prototype.saveQuoteClasses = function () {
            return this;
        };
        class_5.prototype.setWorksheets = function () {
            return this;
        };
        class_5.prototype.saveQuoteState = function () {
            return this;
        };
        class_5.prototype.saveQuoteRateRetries = function () {
            return this;
        };
        class_5.prototype.syncRatingState = function (quote) {
            return Promise.resolve(quote);
        };
        class_5.prototype.ensurePendingRate = function (quote) {
            return Promise.resolve(quote);
        };
        class_5.prototype.saveQuoteMeta = function (_, __, ___, ____) {
            return this;
        };
        class_5.prototype.mergeData = function () {
            return this;
        };
        class_5.prototype.saveQuoteLockState = function () {
            throw new Error('Unused method');
        };
        class_5.prototype.getWorksheet = function () {
            throw new Error('Unused method');
        };
        return class_5;
    }()))();
    var session = {
        isInternal: function () { return false; },
    };
    var quote = {
        getProgramId: function () { return program_id; },
        getProgram: function () { return program; },
        getId: function () { return 0; },
        setLastPremiumDate: function () { return quote; },
        setRatedDate: function () { return quote; },
        getRatedDate: function () { return 0; },
        getLastPremiumDate: function () { return 0; },
        getCurrentStepId: function () { return 0; },
        setCurrentStepId: function () { return quote; },
        setExplicitLock: function () { return quote; },
        setRateBucket: function () { return quote; },
        setRatingData: function () { return quote; },
        getRatingData: function () { return stub_rate_data; },
        getBucket: function () { return new QuoteDataBucket_1.QuoteDataBucket(); },
        getMetabucket: function () { return new QuoteDataBucket_1.QuoteDataBucket(); },
        getMetaUpdatedDate: function () { return 0; },
        getProgramVersion: function () { return 'Foo'; },
        getExplicitLockReason: function () { return 'Reason'; },
        getExplicitLockStep: function () { return 1; },
        isImported: function () { return true; },
        isBound: function () { return true; },
        getTopVisitedStepId: function () { return 1; },
        getTopSavedStepId: function () { return 1; },
        setTopSavedStepId: function () { return quote; },
        setRetryAttempts: function () { return quote; },
        getRetryAttempts: function () { return 1; },
        retryAttempted: function () { return quote; },
        setMetadata: function () { return quote; },
        getRetryCount: function () {
            return { field_count: 2, true_count: 0 };
        },
        setInitialRatedDate: function () { return quote; },
        getExpirationDate: function () { return 123; },
    };
    var ts_ctor = function () {
        return 2592001;
    };
    return {
        program: program,
        stub_rate_data: stub_rate_data,
        stub_rate_delta: stub_rate_delta,
        createDelta: createDelta,
        rater: rater,
        raters: raters,
        logger: logger,
        dao: dao,
        session: session,
        quote: quote,
        ts_ctor: ts_ctor,
    };
}
//# sourceMappingURL=data:application/json;base64, 