"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WEB_SITE_VIEW_WELCOME_PAGE_SUBTYPE = exports.CATEGORY_PARAGRAPH_TEMPLATE_SUBTYPE = exports.CATEGORY_PAGE_TEMPLATE_SUBTYPE = exports.PAGE_WITH_SECTION_PARAGRAPH_SECTION_PARAGRAPH_SUBTYPE = exports.PARAGRAPH_CONTAINER_TEXT_PARAGRAPH_SUBTYPE = exports.PAGE_WITH_TEXT_PARAGRAPH_TEXT_PARAGRAPH_SUBTYPE = exports.WEB_SITE_WITH_LAYOUT_CONFIGURATION_LAYOUT_TEMPLATE_SUBTYPE = exports.CATEGORY_LAYOUT_TEMPLATE_SUBTYPE = exports.CATEGORY_MENU_TEMPLATE_SUBTYPE = exports.DEFAULT_WEB_SITE_TEMPLATE_TYPE = exports.MENU_ENTRY_TYPE = exports.PARAGRAPH_WITH_TEMPLATE_CHOICE_TYPE = exports.PAGE_WITH_TEMPLATE_CHOICE = exports.WELCOME_PAGE_TYPE = exports.PAGE_WITH_SECTION_PARAGRAPH_TYPE = exports.PAGE_WITH_TEXT_PARAGRAPH_TYPE = exports.PAGE_WITH_PARAGRAPH_TYPE = exports.PAGE_WITH_SUB_PAGE_TYPE = exports.SECTION_PARAGRAPH_TYPE = exports.PARAGRAPH_CONTAINER_TYPE = exports.TEXT_PARAGRAPH_TYPE = exports.PARAGRAPH_WITH_PAGE_LINK = exports.PAGE_PARAGRAPH_TYPE = exports.PARAGRAPH_TYPE = exports.PAGE_TYPE = exports.WEB_SITE_WITH_LAYOUT_TEMPLATE_TYPE = exports.WEB_SITE_WITH_MENU_TEMPLATE_TYPE = exports.WEB_SITE_WITH_PARAGRAPHS_TEMPLATE_TYPE = exports.WEB_SITE_WITH_PAGES_TEMPLATE_TYPE = exports.LAYOUT_TEMPLATE_TYPE = exports.MENU_TEMPLATE_TYPE = exports.WEB_SITE_TEMPLATE_TYPE = exports.PAGE_TEMPLATE_TYPE = exports.PARAGRAPH_TEMPLATE_TYPE = exports.WEB_SITE_WITH_LAYOUT_CONFIGURATION_TYPE = exports.WEB_SITE_MENU_ENTRIES_TYPE = exports.WEB_SITE_VIEW_WITH_POPUP = exports.WEB_SITE_LAYOUT_TYPE = exports.WEB_SITE_VIEW_TYPE = exports.ADMIN_ENTRY_TYPE = exports.WEB_SITE_NAME = exports.WEB_SITE_PROVIDER = void 0;
const application_service_1 = require("../../services/application.service");
const object_tree_const_1 = require("../../services/object-tree/object-tree.const");
const utils_common_const_1 = require("../utils-common/utils-common.const");
const content_generic_template_const_1 = require("./../content-generic-template/content-generic-template.const");
exports.WEB_SITE_PROVIDER = 'WebSiteProvider';
exports.WEB_SITE_NAME = 'WebSiteService';
exports.ADMIN_ENTRY_TYPE = {
    name: 'AdminEntry',
    definition: {
        properties: {
            adminTitle: {
                type: 'string',
                title: 'Admin menu label',
                'x-schema-form': {
                    type: 'conditional-text',
                    conditionalValue: {
                        title: 'Display as entry in administration menu',
                        defaultValue: 'return "Admin"',
                    },
                },
            },
        },
    },
};
exports.WEB_SITE_VIEW_TYPE = {
    name: 'WebSiteView',
    title: 'Web site',
    inheritedTypesIds: [content_generic_template_const_1.TEMPLATE_REFERRER_TYPE.name, exports.ADMIN_ENTRY_TYPE.name],
    definition: {
        properties: {
            webSiteObjectTreeId: {
                type: 'string',
                title: 'Web Site Template',
                default: '',
                required: true,
                oneOfTree: [
                    {
                        treeType: 'WebSiteTemplate',
                        namespaceName: 'templates',
                        namespaceType: 'RepositoryCategory',
                        ownerName: 'public',
                        ownerType: 'Repository',
                    },
                    {
                        treeType: 'WebSiteTemplate',
                    },
                ],
            },
        },
    },
    iconView: 'fas fa-globe',
};
exports.WEB_SITE_LAYOUT_TYPE = {
    name: 'WebSiteLayout',
    title: 'Page site layout',
    inheritedTypesIds: [utils_common_const_1.OPTIONAL_LABEL_TYPE.name],
    definition: {
        properties: {
            putInContainer: { type: 'boolean', tittle: 'Add side margin' },
            color: {
                type: 'string',
                title: 'Text color',
                'x-schema-form': {
                    type: 'conditional-color',
                    conditionalValue: {
                        title: 'Change text color',
                        defaultValue: 'return "#000000"',
                    },
                },
            },
            backgroundColor: {
                type: 'string',
                title: 'Background color',
                'x-schema-form': {
                    type: 'conditional-color',
                    conditionalValue: {
                        title: 'Change background color',
                        defaultValue: 'return "#ffffff"',
                    },
                },
            },
            titleAlignment: {
                type: 'string',
                title: 'Title alignment',
                oneOf: [
                    {
                        enum: ['center'],
                        title: 'Center',
                    },
                    {
                        enum: ['left'],
                        title: 'Left',
                    },
                    {
                        enum: ['right'],
                        title: 'Right',
                    },
                ],
                'x-schema-form': {
                    type: 'conditional-select',
                    conditionalValue: {
                        title: 'Change titles alignment',
                        defaultValue: 'return "left"',
                    },
                },
            },
        },
    },
    iconView: 'fas fa-palette',
};
exports.WEB_SITE_VIEW_WITH_POPUP = {
    name: 'WebSiteViewWithPopup',
    inheritedTypesIds: [exports.WEB_SITE_VIEW_TYPE.name],
    definition: {
        properties: {
            popupLinkLabels: {
                type: 'object',
                title: 'Popup labels',
                properties: {
                    pageLinkLabel: {
                        type: 'string',
                        title: 'Popup page link label',
                        'x-schema-form': {
                            type: 'conditional-text',
                            conditionalValue: {
                                title: 'Display popup link to content',
                                defaultValue: 'return "Navigate to page"',
                            },
                        },
                    },
                },
            },
        },
    },
};
exports.WEB_SITE_MENU_ENTRIES_TYPE = {
    name: 'WebSiteMenuEntries',
    inheritedTypesIds: [exports.WEB_SITE_VIEW_TYPE.name],
    definition: {
        properties: {
            menuTitle: {
                type: 'string',
                title: 'Menu title',
                default: '',
                required: true,
            },
            menuEntries: {
                type: 'object',
                title: 'Menu entries',
                properties: {},
            },
            webSiteObjectTreeId: {
                type: 'string',
                title: 'Web Site Template',
                default: '',
                required: true,
                oneOfTree: [
                    {
                        treeType: 'WebSiteWitHMenuTemplate',
                        namespaceName: 'templates',
                        namespaceType: 'RepositoryCategory',
                        ownerName: 'public',
                        ownerType: 'Repository',
                    },
                    {
                        treeType: 'WebSiteWitHMenuTemplate',
                    },
                ],
            },
        },
    },
};
exports.WEB_SITE_WITH_LAYOUT_CONFIGURATION_TYPE = {
    name: 'WebSiteWithLayoutConfiguration',
    title: 'Layout configuration',
};
exports.PARAGRAPH_TEMPLATE_TYPE = {
    name: 'ParagraphTemplate',
    inheritedTypesIds: [content_generic_template_const_1.TEMPLATE_VIEW_TYPE.name],
    definition: {
        properties: {},
    },
    contentType: '',
};
exports.PAGE_TEMPLATE_TYPE = {
    name: 'PageTemplate',
    inheritedTypesIds: [content_generic_template_const_1.TEMPLATE_VIEW_TYPE.name, exports.PARAGRAPH_TEMPLATE_TYPE.name],
    definition: {
        properties: {},
    },
    contentType: '',
};
exports.WEB_SITE_TEMPLATE_TYPE = {
    name: 'WebSiteTemplate',
    inheritedTypesIds: [content_generic_template_const_1.TEMPLATE_VIEW_TYPE.name, content_generic_template_const_1.TEMPLATE_REFERRER_TYPE.name],
    definition: {
        properties: {
            pageTemplateObjectTreeId: {
                title: 'Page template',
                type: 'string',
                oneOfTree: [
                    {
                        treeType: exports.PAGE_TEMPLATE_TYPE.name,
                        namespaceName: object_tree_const_1.TEMPLATES_OBJECT_NAME,
                        namespaceType: application_service_1.ObjectTypeName.REPOSITORY_CATEGORY,
                        ownerName: object_tree_const_1.PUBLIC_OBJECT_NAME,
                        ownerType: application_service_1.ObjectTypeName.REPOSITORY,
                    },
                    {
                        treeType: exports.PAGE_TEMPLATE_TYPE.name,
                    },
                ],
            },
            pageTemplateConfigurationObjectTreeId: {
                type: 'string',
                title: 'Page template Configuration',
            },
            paragraphTemplateObjectTreeId: {
                title: 'Paragraph template',
                type: 'string',
                oneOfTree: [
                    {
                        treeType: exports.PARAGRAPH_TEMPLATE_TYPE.name,
                        namespaceName: object_tree_const_1.TEMPLATES_OBJECT_NAME,
                        namespaceType: application_service_1.ObjectTypeName.REPOSITORY_CATEGORY,
                        ownerName: object_tree_const_1.PUBLIC_OBJECT_NAME,
                        ownerType: application_service_1.ObjectTypeName.REPOSITORY,
                    },
                    {
                        treeType: exports.PARAGRAPH_TEMPLATE_TYPE.name,
                    },
                ],
            },
            paragraphTemplateConfigurationObjectTreeId: {
                type: 'string',
                title: 'Paragraph template Configuration',
            },
        },
    },
    contentType: '',
};
exports.MENU_TEMPLATE_TYPE = {
    name: 'MenuTemplate',
    inheritedTypesIds: [content_generic_template_const_1.TEMPLATE_VIEW_TYPE.name],
    definition: {
        properties: {},
    },
    contentType: '',
};
exports.LAYOUT_TEMPLATE_TYPE = {
    name: 'LayoutTemplate',
    inheritedTypesIds: [content_generic_template_const_1.TEMPLATE_VIEW_TYPE.name],
    definition: {
        properties: {},
    },
    contentType: '',
};
exports.WEB_SITE_WITH_PAGES_TEMPLATE_TYPE = {
    name: 'WebSiteWitHPagesTemplate',
    inheritedTypesIds: [exports.WEB_SITE_TEMPLATE_TYPE.name],
    definition: {
        properties: {
            pageTemplateChoices: {
                title: 'Page templates choice',
                type: 'array',
                items: {
                    type: 'object',
                    properties: {
                        pageTypeKey: {
                            type: 'string',
                            title: 'Page type key',
                        },
                        pageTypeName: {
                            type: 'string',
                            title: 'Page type name',
                        },
                        pageTemplateObjectTreeId: {
                            title: 'Page template',
                            type: 'string',
                            oneOfTree: [
                                {
                                    treeType: exports.PAGE_TEMPLATE_TYPE.name,
                                    namespaceName: object_tree_const_1.TEMPLATES_OBJECT_NAME,
                                    namespaceType: application_service_1.ObjectTypeName.REPOSITORY_CATEGORY,
                                    ownerName: object_tree_const_1.PUBLIC_OBJECT_NAME,
                                    ownerType: application_service_1.ObjectTypeName.REPOSITORY,
                                },
                                {
                                    treeType: exports.PAGE_TEMPLATE_TYPE.name,
                                },
                            ],
                        },
                        pageTypes: {
                            type: 'array',
                            title: 'Page types',
                            items: {
                                type: 'string',
                            },
                        },
                    },
                },
            },
        },
    },
    contentType: '',
};
exports.WEB_SITE_WITH_PARAGRAPHS_TEMPLATE_TYPE = {
    name: 'WebSiteWitHParagraphsTemplate',
    inheritedTypesIds: [exports.WEB_SITE_TEMPLATE_TYPE.name],
    definition: {
        properties: {
            paragraphTemplateChoices: {
                title: 'Paragraph templates choice',
                type: 'array',
                items: {
                    type: 'object',
                    properties: {
                        paragraphTypeKey: {
                            type: 'string',
                            title: 'Paragraph type key',
                        },
                        paragraphTypeName: {
                            type: 'string',
                            title: 'Paragraph type name',
                        },
                        paragraphTemplateObjectTreeId: {
                            title: 'Paragraph template',
                            type: 'string',
                            oneOfTree: [
                                {
                                    treeType: exports.PARAGRAPH_TEMPLATE_TYPE.name,
                                    namespaceName: object_tree_const_1.TEMPLATES_OBJECT_NAME,
                                    namespaceType: application_service_1.ObjectTypeName.REPOSITORY_CATEGORY,
                                    ownerName: object_tree_const_1.PUBLIC_OBJECT_NAME,
                                    ownerType: application_service_1.ObjectTypeName.REPOSITORY,
                                },
                                {
                                    treeType: exports.PARAGRAPH_TEMPLATE_TYPE.name,
                                },
                            ],
                        },
                        paragraphTypes: {
                            type: 'array',
                            title: 'Paragraph types',
                            items: {
                                type: 'string',
                            },
                        },
                    },
                },
            },
        },
    },
    contentType: '',
};
exports.WEB_SITE_WITH_MENU_TEMPLATE_TYPE = {
    name: 'WebSiteWitHMenuTemplate',
    inheritedTypesIds: [exports.WEB_SITE_TEMPLATE_TYPE.name],
    definition: {
        properties: {
            menuObjectTreeId: {
                title: 'Menu template',
                type: 'string',
                oneOfTree: [
                    {
                        treeType: exports.MENU_TEMPLATE_TYPE.name,
                        namespaceName: object_tree_const_1.TEMPLATES_OBJECT_NAME,
                        namespaceType: application_service_1.ObjectTypeName.REPOSITORY_CATEGORY,
                        ownerName: object_tree_const_1.PUBLIC_OBJECT_NAME,
                        ownerType: application_service_1.ObjectTypeName.REPOSITORY,
                    },
                    {
                        treeType: exports.MENU_TEMPLATE_TYPE.name,
                    },
                ],
            },
            menuEntries: {
                type: 'array',
                title: 'Menu entries',
                items: {
                    type: 'object',
                    properties: {
                        entryKey: {
                            type: 'string',
                            title: 'Entry key',
                        },
                        entryName: {
                            type: 'string',
                            title: 'Entry name',
                        },
                        menuEntryLabelKey: {
                            type: 'string',
                            title: 'Menu entry label key',
                            default: 'name',
                        },
                        adminEntry: {
                            type: 'boolean',
                            title: 'Redirect to the admin tool',
                            default: false,
                        },
                        entryTypes: {
                            type: 'array',
                            title: 'Entry types',
                            items: {
                                type: 'string',
                            },
                        },
                    },
                },
            },
        },
    },
    contentType: '',
};
exports.WEB_SITE_WITH_LAYOUT_TEMPLATE_TYPE = {
    name: 'WebSiteWithLayoutTemplate',
    inheritedTypesIds: [exports.WEB_SITE_TEMPLATE_TYPE.name],
    definition: {
        properties: {
            layoutObjectTreeId: {
                title: 'Layout template',
                type: 'string',
                oneOfTree: [
                    {
                        treeType: exports.LAYOUT_TEMPLATE_TYPE.name,
                        namespaceName: object_tree_const_1.TEMPLATES_OBJECT_NAME,
                        namespaceType: application_service_1.ObjectTypeName.REPOSITORY_CATEGORY,
                        ownerName: object_tree_const_1.PUBLIC_OBJECT_NAME,
                        ownerType: application_service_1.ObjectTypeName.REPOSITORY,
                    },
                    {
                        treeType: exports.LAYOUT_TEMPLATE_TYPE.name,
                    },
                ],
            },
        },
    },
    contentType: '',
};
exports.PAGE_TYPE = {
    name: 'Page',
    title: 'Page',
    inheritedTypesIds: [],
    definition: {
        properties: {
            pageTitle: {
                title: 'Page title',
                type: 'string',
                'x-schema-form': {
                    type: 'conditional-text',
                    conditionalValue: {
                        title: 'Display in a dedicated page and specify the page title',
                        defaultValue: 'return model.title',
                    },
                },
            },
        },
    },
    contentType: 'ContentText',
    iconView: 'far fa-file-alt',
};
exports.PARAGRAPH_TYPE = {
    name: 'Paragraph',
    definition: {
        properties: {
            paragraphTitle: {
                title: 'Paragraph title',
                type: 'string',
                'x-schema-form': {
                    type: 'conditional-text',
                    conditionalValue: {
                        title: 'Specify a specific paragraph title',
                        defaultValue: 'return model.title',
                    },
                },
            },
        },
    },
    contentType: '',
};
exports.PAGE_PARAGRAPH_TYPE = {
    name: 'PageParagraph',
    inheritedTypesIds: [exports.PAGE_TYPE.name, exports.PARAGRAPH_TYPE.name],
    definition: {
        properties: {
            paragraphDisplay: {
                title: 'Paragraph content display',
                type: 'string',
                oneOf: [
                    {
                        enum: ['display'],
                        title: 'Display the paragraph',
                    },
                    {
                        enum: ['hide'],
                        title: 'Hide the paragraph',
                    },
                    {
                        enum: ['link'],
                        title: 'Display as a link to another page',
                    },
                ],
                'x-schema-form': {
                    type: 'conditional-select',
                    conditionalValue: {
                        title: 'Change the render of the paragraph in the parent page',
                        defaultValue: 'return "display"',
                    },
                    condition: { functionBody: 'return !!model.pageTitle' },
                },
            },
        },
    },
};
exports.PARAGRAPH_WITH_PAGE_LINK = {
    name: 'ParagraphWithPageLink',
    definition: {
        properties: {
            linkedPageObjectTreeId: {
                title: 'Linked page',
                type: 'string',
                oneOfNode: [
                    {
                        nodeType: exports.PAGE_TYPE.name,
                    },
                ],
            },
        },
    },
};
exports.TEXT_PARAGRAPH_TYPE = {
    inheritedTypesIds: [exports.PARAGRAPH_TYPE.name],
    name: 'TextParagraph',
    title: 'Paragraph',
    definition: {
        properties: {},
    },
    contentType: 'ContentText',
    iconView: 'fas fa-align-left',
};
exports.PARAGRAPH_CONTAINER_TYPE = {
    inheritedTypesIds: [],
    name: 'ParagraphContainer',
};
exports.SECTION_PARAGRAPH_TYPE = {
    inheritedTypesIds: [exports.PARAGRAPH_TYPE.name, exports.PARAGRAPH_CONTAINER_TYPE.name],
    name: 'SectionParagraph',
    definition: {
        properties: {},
    },
    contentType: '',
};
exports.PAGE_WITH_SUB_PAGE_TYPE = {
    inheritedTypesIds: [exports.PAGE_TYPE.name],
    name: 'PageWithSubPage',
};
exports.PAGE_WITH_PARAGRAPH_TYPE = {
    inheritedTypesIds: [exports.PAGE_TYPE.name],
    name: 'PageWithParagraph',
};
exports.PAGE_WITH_TEXT_PARAGRAPH_TYPE = {
    inheritedTypesIds: [exports.PAGE_WITH_PARAGRAPH_TYPE.name],
    name: 'PageWithTextParagraph',
};
exports.PAGE_WITH_SECTION_PARAGRAPH_TYPE = {
    inheritedTypesIds: [exports.PAGE_WITH_PARAGRAPH_TYPE.name],
    name: 'PageWithSectionParagraph',
};
exports.WELCOME_PAGE_TYPE = {
    name: 'WelcomePage',
    title: 'Welcome page',
    inheritedTypesIds: [exports.PAGE_TYPE.name],
    definition: {
        properties: {},
    },
    iconView: 'fas fa-door-open',
};
exports.PAGE_WITH_TEMPLATE_CHOICE = {
    name: 'PageWithTemplateChoice',
    inheritedTypesIds: [exports.PAGE_TYPE.name],
    definition: {
        properties: {
            pageTemplateChoice: {
                title: 'Page display choice',
                type: 'string',
            },
        },
    },
};
exports.PARAGRAPH_WITH_TEMPLATE_CHOICE_TYPE = {
    name: 'ParagraphWithTemplateChoice',
    inheritedTypesIds: [exports.PARAGRAPH_TYPE.name],
    definition: {
        properties: {
            paragraphTemplateChoice: {
                title: 'Paragraph display choice',
                type: 'string',
            },
        },
    },
};
exports.MENU_ENTRY_TYPE = {
    name: 'MenuEntry',
    inheritedTypesIds: [exports.PAGE_TYPE.name],
    definition: {
        properties: {
            menuTitle: {
                title: 'Menu entry label',
                type: 'string',
                'x-schema-form': {
                    type: 'conditional-text',
                    conditionalValue: {
                        title: 'Use this page as a menu entry',
                        defaultValue: 'return model.title',
                    },
                },
            },
        },
    },
    contentType: '',
    iconView: 'fas fa-bars',
};
exports.DEFAULT_WEB_SITE_TEMPLATE_TYPE = {
    name: 'DefaultWebSiteTemplate',
    inheritedTypesIds: [
        exports.WEB_SITE_WITH_MENU_TEMPLATE_TYPE.name,
        exports.WEB_SITE_WITH_PARAGRAPHS_TEMPLATE_TYPE.name,
        exports.WEB_SITE_WITH_LAYOUT_TEMPLATE_TYPE.name,
    ],
    definition: {
        properties: {},
    },
    contentType: '',
};
exports.CATEGORY_MENU_TEMPLATE_SUBTYPE = {
    typeName: object_tree_const_1.REPOSITORY_CATEGORY_TYPE.name,
    subTypeName: exports.MENU_TEMPLATE_TYPE.name,
    tree: true,
};
exports.CATEGORY_LAYOUT_TEMPLATE_SUBTYPE = {
    typeName: object_tree_const_1.REPOSITORY_CATEGORY_TYPE.name,
    subTypeName: exports.LAYOUT_TEMPLATE_TYPE.name,
    tree: true,
};
exports.WEB_SITE_WITH_LAYOUT_CONFIGURATION_LAYOUT_TEMPLATE_SUBTYPE = {
    typeName: exports.WEB_SITE_WITH_LAYOUT_CONFIGURATION_TYPE.name,
    subTypeName: exports.WEB_SITE_LAYOUT_TYPE.name,
};
exports.PAGE_WITH_TEXT_PARAGRAPH_TEXT_PARAGRAPH_SUBTYPE = {
    typeName: exports.PAGE_WITH_TEXT_PARAGRAPH_TYPE.name,
    subTypeName: exports.TEXT_PARAGRAPH_TYPE.name,
};
exports.PARAGRAPH_CONTAINER_TEXT_PARAGRAPH_SUBTYPE = {
    typeName: exports.PARAGRAPH_CONTAINER_TYPE.name,
    subTypeName: exports.TEXT_PARAGRAPH_TYPE.name,
};
exports.PAGE_WITH_SECTION_PARAGRAPH_SECTION_PARAGRAPH_SUBTYPE = {
    typeName: exports.PAGE_WITH_SECTION_PARAGRAPH_TYPE.name,
    subTypeName: exports.SECTION_PARAGRAPH_TYPE.name,
};
exports.CATEGORY_PAGE_TEMPLATE_SUBTYPE = {
    typeName: object_tree_const_1.REPOSITORY_CATEGORY_TYPE.name,
    subTypeName: exports.PAGE_TEMPLATE_TYPE.name,
    tree: true,
};
exports.CATEGORY_PARAGRAPH_TEMPLATE_SUBTYPE = {
    typeName: object_tree_const_1.REPOSITORY_CATEGORY_TYPE.name,
    subTypeName: exports.PARAGRAPH_TEMPLATE_TYPE.name,
    tree: true,
};
exports.WEB_SITE_VIEW_WELCOME_PAGE_SUBTYPE = {
    typeName: exports.WEB_SITE_VIEW_TYPE.name,
    subTypeName: exports.WELCOME_PAGE_TYPE.name,
    min: 1,
    max: 1,
};
//# sourceMappingURL=web-site.const.js.map