"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentGenericTemplateService = exports.ContentGenericTemplateRepository = exports.ContentGenericTemplate = exports.GenericTemplate = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@loopback/core");
const repository_1 = require("@loopback/repository");
const content_extension_definition_1 = require("../../integration/content-extension.definition");
const content_entity_service_1 = require("../../services/content-entity/content-entity.service");
const constants_1 = require("./../../constants");
const db_datasource_1 = require("./../../datasources/db.datasource");
const content_generic_template_const_1 = require("./content-generic-template.const");
let GenericTemplate = class GenericTemplate extends repository_1.Entity {
};
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], GenericTemplate.prototype, "templateMustache", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], GenericTemplate.prototype, "headerScript", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], GenericTemplate.prototype, "footerScript", void 0);
tslib_1.__decorate([
    repository_1.property({ type: 'array', default: [], itemType: 'string' }),
    tslib_1.__metadata("design:type", Array)
], GenericTemplate.prototype, "templatesMustache", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], GenericTemplate.prototype, "templateAngular", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], GenericTemplate.prototype, "scss", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], GenericTemplate.prototype, "css", void 0);
tslib_1.__decorate([
    repository_1.property({
        type: 'string',
    }),
    tslib_1.__metadata("design:type", String)
], GenericTemplate.prototype, "controller", void 0);
tslib_1.__decorate([
    repository_1.property({
        required: false,
    }),
    tslib_1.__metadata("design:type", Object)
], GenericTemplate.prototype, "refererConfig", void 0);
GenericTemplate = tslib_1.__decorate([
    repository_1.model()
], GenericTemplate);
exports.GenericTemplate = GenericTemplate;
let ContentGenericTemplate = class ContentGenericTemplate extends content_extension_definition_1.ContentExtension {
};
ContentGenericTemplate = tslib_1.__decorate([
    repository_1.model({ settings: { strict: false } })
], ContentGenericTemplate);
exports.ContentGenericTemplate = ContentGenericTemplate;
let ContentGenericTemplateRepository = class ContentGenericTemplateRepository extends content_extension_definition_1.ContentExtensionRepository {
    constructor(dataSource, objectNodeRepositoryGetter) {
        super(ContentGenericTemplate, dataSource, objectNodeRepositoryGetter);
        this.objectNodeRepositoryGetter = objectNodeRepositoryGetter;
    }
};
ContentGenericTemplateRepository = tslib_1.__decorate([
    tslib_1.__param(0, core_1.inject(constants_1.DATASTORE_DB)),
    tslib_1.__param(1, repository_1.repository.getter('ObjectNodeRepository')),
    tslib_1.__metadata("design:paramtypes", [db_datasource_1.DbDataSource, Function])
], ContentGenericTemplateRepository);
exports.ContentGenericTemplateRepository = ContentGenericTemplateRepository;
let ContentGenericTemplateService = class ContentGenericTemplateService extends content_extension_definition_1.ContentExtensionService {
    constructor(contentEntityService, contentExtensionRepository) {
        super(content_generic_template_const_1.CONTENT_GENERIC_PROVIDER, ContentGenericTemplateService.name, contentEntityService, contentExtensionRepository, content_generic_template_const_1.CONTENT_GENERIC_TEMPLATE);
        this.contentEntityService = contentEntityService;
        this.contentExtensionRepository = contentExtensionRepository;
    }
    async getContentDefinition() {
        return {
            properties: {
                contentGenericTemplate: {
                    type: 'object',
                    title: 'Layout definition',
                    properties: {
                        templateMustache: {
                            type: 'string',
                            title: 'Template Mustache',
                            default: '',
                            required: true,
                            'x-schema-form': {
                                type: 'textarea',
                            },
                        },
                        headerScript: {
                            type: 'string',
                            title: 'Script javascript added ih the page header',
                            default: '',
                            required: true,
                            'x-schema-form': {
                                type: 'textarea',
                            },
                        },
                        footerScript: {
                            type: 'string',
                            title: 'Script javascript added at the page bottom',
                            default: '',
                            required: true,
                            'x-schema-form': {
                                type: 'textarea',
                            },
                        },
                        templatesMustache: {
                            type: 'object',
                            title: 'Recursive template Mustache',
                            default: {},
                            required: false,
                            'x-schema-form': {
                                type: 'json',
                            },
                        },
                        css: {
                            type: 'string',
                            title: 'Mustache css',
                            default: '',
                            'x-schema-form': {
                                type: 'textarea',
                            },
                        },
                        templateAngular: {
                            type: 'string',
                            title: 'Template Angular',
                            default: '',
                            required: true,
                            'x-schema-form': {
                                type: 'textarea',
                            },
                        },
                        scss: {
                            type: 'string',
                            title: 'Scss',
                            default: '',
                            'x-schema-form': {
                                type: 'textarea',
                            },
                        },
                        controller: {
                            type: 'string',
                            title: 'Controller',
                            default: '',
                            'x-schema-form': {
                                type: 'textarea',
                            },
                        },
                        /*
                        config: {
                          type: 'object',
                          title: 'Template configuration definition',
                          default: '',
                          'x-schema-form': {
                            type: 'json',
                          },
                        },*/
                        refererConfig: {
                            type: 'object',
                            title: 'Referer configuration definition',
                            default: '',
                            'x-schema-form': {
                                type: 'json',
                            },
                        },
                    },
                },
            },
        };
    }
};
ContentGenericTemplateService = tslib_1.__decorate([
    tslib_1.__param(0, core_1.service(content_entity_service_1.ContentEntityService)),
    tslib_1.__param(1, repository_1.repository(ContentGenericTemplateRepository)),
    tslib_1.__metadata("design:paramtypes", [content_entity_service_1.ContentEntityService,
        ContentGenericTemplateRepository])
], ContentGenericTemplateService);
exports.ContentGenericTemplateService = ContentGenericTemplateService;
//# sourceMappingURL=content-generic-template.definition.js.map