"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadReportBuilderReportPublications = loadReportBuilderReportPublications;
var simpl_schema_1 = require("simpl-schema");
var report_builder_report_collection_1 = require("../collections/report-builder-report.collection");
function loadReportBuilderReportPublications(subscriptionManager) {
    subscriptionManager.publications({
        reportbuilderreports: {
            function: function () {
                return report_builder_report_collection_1.ReportBuilderReports.find({}, { sort: { report_name: 1 } });
            },
            collections: ['report-builder-reports']
        },
        reportbuilderreportsWithIdUser: {
            check: new simpl_schema_1.default({
                id_user: {
                    type: String
                }
            }),
            function: function (id_user) {
                return report_builder_report_collection_1.ReportBuilderReports.find({ id_user: id_user });
            },
            collections: ['report-builder-reports']
        },
        reportbuilderreportWithId: {
            check: new simpl_schema_1.default({
                id: {
                    type: String
                }
            }),
            function: function (id) {
                return report_builder_report_collection_1.ReportBuilderReports.findOne({ _id: id });
            },
            collections: ['report-builder-reports']
        },
        reportbuilderreportsWithCustomerId: {
            check: new simpl_schema_1.default({
                id: {
                    type: String
                }
            }),
            function: function (id) {
                return report_builder_report_collection_1.ReportBuilderReports.find({ shared_users: { $in: [id] } });
            },
            collections: ['report-builder-reports']
        }
    });
}

//# sourceMappingURL=report-builder-reports.js.map
