"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.quote_factory = void 0;
var TE = require("fp-ts/TaskEither");
var loader_1 = require("../../server/quote/loader");
var function_1 = require("fp-ts/function");
/**
 * Create and init a new quote/document
 *
 * @param dao         - mongo dao
 * @param quote_maker - logic for how to create quote
 * @param session     - user session
 * @param doc_data    - preliminary data to load onto the document
 * @param program     - relevant program
 *
 * @return a quote
 */
exports.quote_factory = function (dao) { return function (quote_maker) { return function (program) { return function (session) { return function (doc_data) {
    return function_1.pipe(loader_1.initNewDocument(dao)(quote_maker(program))(program)(session)(doc_data), TE.getOrElse(function (e) {
        throw e;
    }))();
}; }; }; }; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUXVvdGVGYWN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiUXVvdGVGYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHFDQUF1QztBQU92QyxvREFBMEQ7QUFDMUQsMkNBQW9DO0FBWXBDOzs7Ozs7Ozs7O0dBVUc7QUFDVSxRQUFBLGFBQWEsR0FBRyxVQUFDLEdBQW1CLElBQUssT0FBQSxVQUNwRCxXQUF1QixJQUNwQixPQUFBLFVBQUMsT0FBZ0IsSUFBSyxPQUFBLFVBQUMsT0FBZ0IsSUFBSyxPQUFBLFVBQy9DLFFBQXNCO0lBRXRCLE9BQUEsZUFBSSxDQUNGLHdCQUFlLENBQUMsR0FBRyxDQUFDLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQWMsT0FBTyxDQUFDLENBQ3ZFLFFBQVEsQ0FDVCxFQUNELEVBQUUsQ0FBQyxTQUFTLENBQUMsVUFBQSxDQUFDO1FBQ1osTUFBTSxDQUFDLENBQUM7SUFDVixDQUFDLENBQUMsQ0FDSCxFQUFFO0FBUEgsQ0FPRyxFQVY0QyxDQVU1QyxFQVZzQixDQVV0QixFQVZBLENBVUEsRUFaaUQsQ0FZakQsQ0FBQyJ9