"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSiteProvider = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const __1 = require("../..");
const helper_1 = require("../../helper");
const extension_provider_1 = require("../../integration/extension.provider");
const transient_uri_reference_provider_1 = require("../../services/inside-rest/transient-uri-reference.provider");
const content_generic_template_provider_1 = require("../content-generic-template/content-generic-template.provider");
const server_config_provider_1 = require("../server-config/server-config.provider");
const utils_common_provider_1 = require("../utils-common/utils-common.provider");
const uri_complete_provider_1 = require("./../../services/uri-complete/uri-complete.provider");
const action_web_site_service_1 = require("./action-web-site.service");
const transient_web_site_service_1 = require("./transient-web-site.service");
const web_site_const_1 = require("./web-site.const");
const web_site_service_1 = require("./web-site.service");
class WebSiteProvider extends extension_provider_1.ExtensionProvider {
    constructor(app) {
        super(web_site_const_1.WEB_SITE_PROVIDER, app);
        this.app = app;
        this.requiredProviders.push(uri_complete_provider_1.UriCompleteProvider, transient_uri_reference_provider_1.TransientUriReferenceProvider, content_generic_template_provider_1.ContentGenericTemplateProvider, utils_common_provider_1.UtilsCommonProvider, server_config_provider_1.ServerConfigProvider);
        this.services.push({ cls: web_site_service_1.WebSiteService }, { cls: transient_web_site_service_1.TransientWebSiteService }, { cls: action_web_site_service_1.ActionWebSiteService });
        app.addStaticDir('bootstrap', 'node_modules/bootstrap/dist');
        app.addStaticDir('jquery', 'node_modules/jquery/dist');
        app.addStaticDir('leaflet', 'node_modules/leaflet/dist');
        app.addStaticDir('popup/popup.css', path_1.default.join(__dirname, 'popup/style.css'));
        app.addStaticDir('fontawesome', 'node_modules/@fortawesome/fontawesome-free');
        this.objectTypes.push(web_site_const_1.ADMIN_ENTRY_TYPE, web_site_const_1.WEB_SITE_TEMPLATE_TYPE, web_site_const_1.WEB_SITE_WITH_MENU_TEMPLATE_TYPE, web_site_const_1.WEB_SITE_WITH_PAGES_TEMPLATE_TYPE, web_site_const_1.WEB_SITE_WITH_PARAGRAPHS_TEMPLATE_TYPE, web_site_const_1.WEB_SITE_VIEW_TYPE, web_site_const_1.WEB_SITE_VIEW_WITH_POPUP, web_site_const_1.WEB_SITE_MENU_ENTRIES_TYPE, web_site_const_1.MENU_TEMPLATE_TYPE, web_site_const_1.PAGE_TEMPLATE_TYPE, web_site_const_1.PARAGRAPH_TEMPLATE_TYPE, web_site_const_1.PAGE_TYPE, web_site_const_1.PAGE_WITH_PARAGRAPH_TYPE, web_site_const_1.PARAGRAPH_CONTAINER_TYPE, web_site_const_1.PAGE_WITH_SECTION_PARAGRAPH_TYPE, web_site_const_1.PARAGRAPH_TYPE, web_site_const_1.TEXT_PARAGRAPH_TYPE, web_site_const_1.SECTION_PARAGRAPH_TYPE, web_site_const_1.PAGE_WITH_TEMPLATE_CHOICE, web_site_const_1.PARAGRAPH_WITH_TEMPLATE_CHOICE_TYPE, web_site_const_1.WELCOME_PAGE_TYPE, web_site_const_1.MENU_ENTRY_TYPE, web_site_const_1.PAGE_WITH_SUB_PAGE_TYPE, web_site_const_1.PAGE_WITH_TEXT_PARAGRAPH_TYPE, web_site_const_1.PARAGRAPH_WITH_PAGE_LINK, web_site_const_1.WEB_SITE_LAYOUT_TYPE, web_site_const_1.WEB_SITE_WITH_LAYOUT_CONFIGURATION_TYPE, web_site_const_1.LAYOUT_TEMPLATE_TYPE, web_site_const_1.WEB_SITE_WITH_LAYOUT_TEMPLATE_TYPE, web_site_const_1.DEFAULT_WEB_SITE_TEMPLATE_TYPE, web_site_const_1.PAGE_PARAGRAPH_TYPE);
        this.objectSubTypes.push(web_site_const_1.CATEGORY_MENU_TEMPLATE_SUBTYPE, web_site_const_1.WEB_SITE_VIEW_WELCOME_PAGE_SUBTYPE, web_site_const_1.CATEGORY_PAGE_TEMPLATE_SUBTYPE, web_site_const_1.CATEGORY_PARAGRAPH_TEMPLATE_SUBTYPE, web_site_const_1.PAGE_WITH_TEXT_PARAGRAPH_TEXT_PARAGRAPH_SUBTYPE, web_site_const_1.PAGE_WITH_SECTION_PARAGRAPH_SECTION_PARAGRAPH_SUBTYPE, web_site_const_1.PARAGRAPH_CONTAINER_TEXT_PARAGRAPH_SUBTYPE, web_site_const_1.CATEGORY_LAYOUT_TEMPLATE_SUBTYPE, web_site_const_1.WEB_SITE_WITH_LAYOUT_CONFIGURATION_LAYOUT_TEMPLATE_SUBTYPE);
        this.migrations.push({
            parentType: __1.REPOSITORY_CATEGORY_TYPE.name,
            previousType: web_site_const_1.WEB_SITE_TEMPLATE_TYPE.name,
            newType: web_site_const_1.DEFAULT_WEB_SITE_TEMPLATE_TYPE.name,
        });
        this.objectTrees.navBar = {
            reset: false,
            parentNode: () => this.appCtx.publicTemplatesNode.value,
            treeNodeName: 'navBar',
            treeNodeTypeId: web_site_const_1.MENU_TEMPLATE_TYPE.name,
            tree: {
                treeNode: {
                    contentGenericTemplate: helper_1.contentGenericTemplate(__dirname, 'navBar', [
                        'navbarDropdownItems',
                    ]),
                },
                children: {},
            },
        };
        this.objectTrees.defaultWebSite = {
            reset: false,
            parentNode: () => this.appCtx.publicTemplatesNode.value,
            treeNodeName: 'defaultWebSite',
            treeNodeTypeId: web_site_const_1.DEFAULT_WEB_SITE_TEMPLATE_TYPE.name,
            tree: {
                treeNode: {
                    contentGenericTemplate: helper_1.contentGenericTemplate(__dirname, 'defaultWebSite'),
                    menuObjectTreeId: 'tree/Repository/public/RepositoryCategory/templates/MenuTemplate/navBar',
                    layoutObjectTreeId: 'tree/Repository/public/RepositoryCategory/templates/LayoutTemplate/siteLayout',
                    paragraphTemplateObjectTreeId: 'tree/Repository/public/RepositoryCategory/templates/ParagraphTemplate/cardTextAndImages',
                    pageTemplateObjectTreeId: 'tree/Repository/public/RepositoryCategory/templates/PageTemplate/pageWithParagraph',
                    menuEntries: [
                        {
                            entryKey: 'home',
                            entryName: 'Home',
                            menuEntryLabelKey: 'name',
                            entryTypes: [web_site_const_1.WELCOME_PAGE_TYPE.name],
                        },
                    ],
                    paragraphTemplateChoices: [],
                    paragraphTemplateConfigurationObjectTreeId: 'tree/Repository/public/RepositoryCategory/templates/ParagraphTemplateConfiguration/textAndThumbAfter',
                },
                children: {},
            },
        };
        this.objectTrees.siteLayout = {
            reset: false,
            parentNode: () => this.appCtx.publicTemplatesNode.value,
            treeNodeName: 'siteLayout',
            treeNodeTypeId: web_site_const_1.LAYOUT_TEMPLATE_TYPE.name,
            tree: {
                treeNode: {
                    contentGenericTemplate: helper_1.contentGenericTemplate(__dirname, 'siteLayout'),
                },
                children: {},
            },
        };
        this.objectTrees.card = {
            reset: false,
            parentNode: () => this.appCtx.publicTemplatesNode.value,
            treeNodeName: 'card',
            treeNodeTypeId: web_site_const_1.PARAGRAPH_TEMPLATE_TYPE.name,
            tree: {
                treeNode: {
                    contentGenericTemplate: helper_1.contentGenericTemplate(__dirname, 'card'),
                },
                children: {},
            },
        };
        this.objectTrees.pageWithParagraph = {
            reset: false,
            parentNode: () => this.appCtx.publicTemplatesNode.value,
            treeNodeName: 'pageWithParagraph',
            treeNodeTypeId: web_site_const_1.PAGE_TEMPLATE_TYPE.name,
            tree: {
                treeNode: {
                    contentGenericTemplate: helper_1.contentGenericTemplate(__dirname, 'pageWithParagraph', ['pages', 'paragraphs']),
                },
                children: {},
            },
        };
    }
}
exports.WebSiteProvider = WebSiteProvider;
//# sourceMappingURL=web-site.provider.js.map