"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HomePageController = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@loopback/core");
const rest_1 = require("@loopback/rest");
const generated_response_1 = require("./../../helper/generated-response");
const application_service_1 = require("./../../services/application.service");
const home_page_service_1 = require("./home-page.service");
let HomePageController = class HomePageController {
    constructor(homePageService) {
        this.homePageService = homePageService;
    }
    async getAdminPage(response, ctx) {
        if ('/admin' === ctx.uriContext.uri.value.path) {
            const generatedView = new generated_response_1.RedirectGeneratedResponse(ctx.uriContext.uri.value.baseUri + '/admin/');
            return generatedView.getResponse(response);
        }
        const generatedView = await this.homePageService.renderAdminPage(undefined, ctx);
        return generatedView.getResponse(response);
    }
    async getAdminPageBis(response, ctx) {
        const generatedView = await this.homePageService.renderAdminPage(undefined, ctx);
        return generatedView.getResponse(response);
    }
    async getLoadingPageOfSite(siteName, response, ctx) {
        const generatedView = await this.homePageService.getLoadingPageResponse(ctx, undefined, siteName);
        return generatedView.getResponse(response);
    }
    async getAdminPageSite(siteName, response, ctx) {
        if (!ctx.uriContext.uri.value.path.endsWith('/')) {
            const generatedView = new generated_response_1.RedirectGeneratedResponse(ctx.uriContext.uri.value.path + '/');
            return generatedView.getResponse(response);
        }
        const generatedView = await this.homePageService.renderAdminPage(siteName, ctx);
        return generatedView.getResponse(response);
    }
    async getAdminPageSiteBis(siteName, response, ctx) {
        const generatedView = await this.homePageService.renderAdminPage(siteName, ctx);
        return generatedView.getResponse(response);
    }
    async getFaviconSite(siteName, response, ctx) {
        const generatedView = await this.homePageService.getFavicon(ctx, siteName);
        return generatedView.getResponse(response);
    }
    async getSitemapSite(response, ctx) {
        const generatedView = await this.homePageService.redirectToSiteMap(ctx);
        return generatedView.getResponse(response);
    }
    async getSiteDefaultRobots(siteName, response, ctx) {
        const generatedView = await this.homePageService.getRobotTxt(`/site/${siteName}/fr-FR/`, ctx);
        return generatedView.getResponse(response);
    }
    async getLoadingLangPageOfSite(siteName, lang, response, ctx) {
        const generatedView = await this.homePageService.getLoadingPageResponse(ctx, lang, siteName);
        return generatedView.getResponse(response);
    }
    async getSiteRobots(siteName, lang, response, ctx) {
        const generatedView = await this.homePageService.getRobotTxt(`/site/${siteName}/${lang}/`, ctx);
        return generatedView.getResponse(response);
    }
    async getWebSitePageOfSiteResponse(siteName, lang, name, response, ctx) {
        const generatedView = await this.homePageService.getWebSitePageResponse(lang, name, ctx, siteName);
        return generatedView.getResponse(response);
    }
    async getWebSitePopupOfSiteResponse(siteName, lang, name, response, ctx) {
        const generatedView = await this.homePageService.getWebSitePopupResponse(lang, name, ctx, siteName);
        return generatedView.getResponse(response);
    }
    async getLoadingPage(response, ctx) {
        const generatedView = await this.homePageService.getLoadingPageResponse(ctx);
        return generatedView.getResponse(response);
    }
    async getFavicon(response, ctx) {
        const generatedView = await this.homePageService.getFavicon(ctx);
        return generatedView.getResponse(response);
    }
    async getSitemap(response, ctx) {
        const generatedView = await this.homePageService.redirectToSiteMap(ctx);
        return generatedView.getResponse(response);
    }
    async getRootRobots(response, ctx) {
        const generatedView = await this.homePageService.getRobotTxt('/fr-FR/', ctx);
        return generatedView.getResponse(response);
    }
    async getLoadingLangPage(lang, response, ctx) {
        const generatedView = await this.homePageService.getLoadingPageResponse(ctx, lang);
        return generatedView.getResponse(response);
    }
    async getRobots(lang, response, ctx) {
        const generatedView = await this.homePageService.getRobotTxt(`/${lang}/`, ctx);
        return generatedView.getResponse(response);
    }
    async getWebSitePageResponse(lang, name, response, ctx) {
        const generatedView = await this.homePageService.getWebSitePageResponse(lang, name, ctx);
        return generatedView.getResponse(response);
    }
    async getWebSitePopupResponse(lang, name, response, ctx) {
        const generatedView = await this.homePageService.getWebSitePopupResponse(lang, name, ctx);
        return generatedView.getResponse(response);
    }
};
tslib_1.__decorate([
    rest_1.get('/admin/'),
    tslib_1.__param(0, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(1, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getAdminPage", null);
tslib_1.__decorate([
    rest_1.get('/admin/{any}'),
    tslib_1.__param(0, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(1, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getAdminPageBis", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(2, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getLoadingPageOfSite", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/admin/'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(2, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getAdminPageSite", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/admin/{any}'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(2, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getAdminPageSiteBis", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/favicon.png'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(2, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getFaviconSite", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/sitemap.xml'),
    tslib_1.__param(0, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(1, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getSitemapSite", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/robots.txt'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(2, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getSiteDefaultRobots", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/{lang}'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, rest_1.param.path.string('lang')),
    tslib_1.__param(2, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(3, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getLoadingLangPageOfSite", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/{lang}/robots.txt'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, rest_1.param.path.string('lang')),
    tslib_1.__param(2, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(3, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getSiteRobots", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/{lang}/{name}'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, rest_1.param.path.string('lang')),
    tslib_1.__param(2, rest_1.param.path.string('name')),
    tslib_1.__param(3, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(4, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getWebSitePageOfSiteResponse", null);
tslib_1.__decorate([
    rest_1.get('/site/{siteName}/{lang}/{name}/popup'),
    tslib_1.__param(0, rest_1.param.path.string('siteName')),
    tslib_1.__param(1, rest_1.param.path.string('lang')),
    tslib_1.__param(2, rest_1.param.path.string('name')),
    tslib_1.__param(3, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(4, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getWebSitePopupOfSiteResponse", null);
tslib_1.__decorate([
    rest_1.get('/'),
    tslib_1.__param(0, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(1, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getLoadingPage", null);
tslib_1.__decorate([
    rest_1.get('/favicon.png'),
    tslib_1.__param(0, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(1, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getFavicon", null);
tslib_1.__decorate([
    rest_1.get('/sitemap.xml'),
    tslib_1.__param(0, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(1, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getSitemap", null);
tslib_1.__decorate([
    rest_1.get('/robots.txt'),
    tslib_1.__param(0, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(1, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getRootRobots", null);
tslib_1.__decorate([
    rest_1.get('/{lang}'),
    tslib_1.__param(0, rest_1.param.path.string('lang')),
    tslib_1.__param(1, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(2, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getLoadingLangPage", null);
tslib_1.__decorate([
    rest_1.get('/{lang}/robots.txt'),
    tslib_1.__param(0, rest_1.param.path.string('lang')),
    tslib_1.__param(1, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(2, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getRobots", null);
tslib_1.__decorate([
    rest_1.get('/{lang}/{name}'),
    tslib_1.__param(0, rest_1.param.path.string('lang')),
    tslib_1.__param(1, rest_1.param.path.string('name')),
    tslib_1.__param(2, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(3, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getWebSitePageResponse", null);
tslib_1.__decorate([
    rest_1.get('/{lang}/{name}/popup'),
    tslib_1.__param(0, rest_1.param.path.string('lang')),
    tslib_1.__param(1, rest_1.param.path.string('name')),
    tslib_1.__param(2, core_1.inject(rest_1.RestBindings.Http.RESPONSE)),
    tslib_1.__param(3, core_1.inject(application_service_1.CURRENT_CONTEXT)),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, Object, application_service_1.CurrentContext]),
    tslib_1.__metadata("design:returntype", Promise)
], HomePageController.prototype, "getWebSitePopupResponse", null);
HomePageController = tslib_1.__decorate([
    tslib_1.__param(0, core_1.service(home_page_service_1.HomePageService)),
    tslib_1.__metadata("design:paramtypes", [home_page_service_1.HomePageService])
], HomePageController);
exports.HomePageController = HomePageController;
//# sourceMappingURL=home-page.controller.js.map