"use strict";
var marked = require("marked");
var plugin_1 = require("./plugin");
function createData(projectPackage, graphdocPackage, plugins, type) {
    var name = type && type.name;
    return Promise
        .all([
        plugin_1.Plugin.collectHeaders(plugins, name),
        plugin_1.Plugin.collectNavigations(plugins, name),
        plugin_1.Plugin.collectDocuments(plugins, name),
    ])
        .then(function (_a) {
        var headers = _a[0], navigations = _a[1], documents = _a[2];
        var title = name ||
            projectPackage.graphdoc.title ||
            'Graphql schema documentation';
        var description = type ?
            marked(type.description || '') :
            projectPackage.description;
        return {
            title: title,
            description: description,
            headers: headers.join(''),
            navigations: navigations,
            documents: documents,
            projectPackage: projectPackage,
            graphdocPackage: graphdocPackage,
        };
    });
}
exports.createData = createData;
