"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardCoreController = void 0;
const api_1 = require("@hed-hog/api");
const api_locale_1 = require("@hed-hog/api-locale");
const common_1 = require("@nestjs/common");
const dashboard_core_service_1 = require("./dashboard-core.service");
let DashboardCoreController = class DashboardCoreController {
    constructor(dashboardCoreService) {
        this.dashboardCoreService = dashboardCoreService;
    }
    getHome({ id }, locale) {
        return this.dashboardCoreService.getHome(id, locale);
    }
    getUserStatistics() {
        return this.dashboardCoreService.getUserStatistics();
    }
    getMailStatistics() {
        return this.dashboardCoreService.getMailStatistics();
    }
    getSystemStatistics() {
        return this.dashboardCoreService.getSystemStatistics();
    }
    getConfigOverview() {
        return this.dashboardCoreService.getConfigOverview();
    }
    getWidgetsData(user, locale) {
        return this.dashboardCoreService.getWidgetsData(user.id, locale);
    }
    getUserDashboards(user, locale) {
        return this.dashboardCoreService.getUserDashboards(user.id, locale);
    }
    getAvailableTemplates(user, locale) {
        return this.dashboardCoreService.getAvailableTemplates(user.id, locale);
    }
    createUserDashboard(user, body, locale) {
        return this.dashboardCoreService.createUserDashboard(user.id, body, locale);
    }
    reorderUserDashboards(user, body, locale) {
        return this.dashboardCoreService.reorderUserDashboards(user.id, body.slugs, locale);
    }
    renameUserDashboard(user, slug, body, locale) {
        return this.dashboardCoreService.renameUserDashboard(user.id, slug, body, locale);
    }
    setHomeDashboard(user, slug, locale) {
        return this.dashboardCoreService.setHomeDashboard(user.id, slug, locale);
    }
    getDashboardShares(user, slug, locale) {
        return this.dashboardCoreService.getDashboardShares(user.id, slug, locale);
    }
    getShareableUsers(user, slug, search, page, pageSize, locale) {
        return this.dashboardCoreService.getShareableUsers(user.id, slug, {
            search,
            page,
            pageSize,
        }, locale);
    }
    shareDashboard(user, slug, body, locale) {
        return this.dashboardCoreService.shareDashboard(user.id, slug, body.userIds, body.userId, locale);
    }
    revokeDashboardShare(user, slug, sharedUserId, locale) {
        return this.dashboardCoreService.revokeDashboardShare(user.id, slug, sharedUserId, locale);
    }
    removeUserDashboard(user, slug, locale) {
        return this.dashboardCoreService.removeUserDashboard(user.id, slug, locale);
    }
    checkAccess(user, slug, locale) {
        return this.dashboardCoreService.checkDashboardAccess(user.id, slug, locale);
    }
    getUserLayout(user, slug, locale) {
        return this.dashboardCoreService.getUserLayout(user.id, slug, locale);
    }
    saveUserLayout(user, slug, body) {
        return this.dashboardCoreService.saveUserLayout(user.id, slug, body.layout);
    }
    addWidget(user, slug, body, locale) {
        return this.dashboardCoreService.addWidgetToUserDashboard(user.id, slug, body.componentSlug, locale);
    }
    removeWidget(user, slug, widgetId) {
        return this.dashboardCoreService.removeWidgetFromUserDashboard(user.id, slug, widgetId);
    }
    fromSlug(slug, locale) {
        return this.dashboardCoreService.fromSlug(slug, locale);
    }
};
exports.DashboardCoreController = DashboardCoreController;
__decorate([
    (0, common_1.Get)('home'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getHome", null);
__decorate([
    (0, common_1.Get)('stats/overview/users'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getUserStatistics", null);
__decorate([
    (0, common_1.Get)('stats/overview/mails'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getMailStatistics", null);
__decorate([
    (0, common_1.Get)('stats/overview/system'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getSystemStatistics", null);
__decorate([
    (0, common_1.Get)('config/overview'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getConfigOverview", null);
__decorate([
    (0, common_1.Get)('widgets/me'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getWidgetsData", null);
__decorate([
    (0, common_1.Get)('user-dashboards'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getUserDashboards", null);
__decorate([
    (0, common_1.Get)('templates'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getAvailableTemplates", null);
__decorate([
    (0, common_1.Post)('dashboard'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "createUserDashboard", null);
__decorate([
    (0, common_1.Patch)('dashboard/order'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "reorderUserDashboards", null);
__decorate([
    (0, common_1.Patch)('dashboard/:slug'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, common_1.Body)()),
    __param(3, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "renameUserDashboard", null);
__decorate([
    (0, common_1.Post)('dashboard/:slug/home'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "setHomeDashboard", null);
__decorate([
    (0, common_1.Get)('dashboard/:slug/shares'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getDashboardShares", null);
__decorate([
    (0, common_1.Get)('shareable-users/:slug'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, common_1.Query)('search')),
    __param(3, (0, common_1.Query)('page')),
    __param(4, (0, common_1.Query)('pageSize')),
    __param(5, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String, String, String, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getShareableUsers", null);
__decorate([
    (0, common_1.Post)('dashboard/:slug/share'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, common_1.Body)()),
    __param(3, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "shareDashboard", null);
__decorate([
    (0, common_1.Delete)('dashboard/:slug/share/:sharedUserId'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, common_1.Param)('sharedUserId', common_1.ParseIntPipe)),
    __param(3, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, Number, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "revokeDashboardShare", null);
__decorate([
    (0, common_1.Delete)('dashboard/:slug'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "removeUserDashboard", null);
__decorate([
    (0, common_1.Get)('access/:slug'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "checkAccess", null);
__decorate([
    (0, common_1.Get)('layout/:slug'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "getUserLayout", null);
__decorate([
    (0, common_1.Post)('layout/:slug'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, Object]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "saveUserLayout", null);
__decorate([
    (0, common_1.Post)('widget/:slug'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, common_1.Body)()),
    __param(3, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, Object, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "addWidget", null);
__decorate([
    (0, common_1.Delete)('widget/:slug/:widgetId'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, common_1.Param)('slug')),
    __param(2, (0, common_1.Param)('widgetId')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, String, String]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "removeWidget", null);
__decorate([
    (0, common_1.Get)(':slug'),
    __param(0, (0, common_1.Param)('slug')),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", void 0)
], DashboardCoreController.prototype, "fromSlug", null);
exports.DashboardCoreController = DashboardCoreController = __decorate([
    (0, api_1.Role)(),
    (0, common_1.Controller)('dashboard-core'),
    __metadata("design:paramtypes", [dashboard_core_service_1.DashboardCoreService])
], DashboardCoreController);
//# sourceMappingURL=dashboard-core.controller.js.map