"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.MenuController = void 0;
const api_1 = require("@hed-hog/api");
const api_locale_1 = require("@hed-hog/api-locale");
const api_pagination_1 = require("@hed-hog/api-pagination");
const common_1 = require("@nestjs/common");
const delete_dto_1 = require("../dto/delete.dto");
const update_ids_dto_1 = require("../dto/update-ids.dto");
const create_dto_1 = require("./dto/create.dto");
const order_dto_1 = require("./dto/order.dto");
const update_dto_1 = require("./dto/update.dto");
const menu_service_1 = require("./menu.service");
let MenuController = class MenuController {
    constructor(menuService) {
        this.menuService = menuService;
    }
    async getSystemMenu({ id }, locale) {
        return this.menuService.getSystemMenu(locale, id);
    }
    async stats() {
        return this.menuService.stats();
    }
    async listAll(locale) {
        return this.menuService.listAll(locale);
    }
    async list(paginationParams, locale) {
        return this.menuService.list(locale, paginationParams);
    }
    async listRoles(menuId, paginationParams, locale) {
        return this.menuService.listRoles(locale, menuId, paginationParams);
    }
    async updateRoles(menuId, data, locale) {
        return this.menuService.updateRoles(locale, menuId, data);
    }
    async show(locale, menuId) {
        return this.menuService.get(locale, menuId);
    }
    async create(locale, data) {
        return this.menuService.create(locale, data);
    }
    async updateOrder(locale, data) {
        return this.menuService.updateOrder(locale, data);
    }
    async update(locale, menuId, data) {
        return this.menuService.update(locale, {
            id: menuId,
            data,
        });
    }
    async delete(locale, data) {
        return this.menuService.delete(locale, data);
    }
};
exports.MenuController = MenuController;
__decorate([
    (0, common_1.Get)('system'),
    __param(0, (0, api_1.User)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "getSystemMenu", null);
__decorate([
    (0, common_1.Get)('stats'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "stats", null);
__decorate([
    (0, common_1.Get)('all'),
    __param(0, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "listAll", null);
__decorate([
    (0, common_1.Get)(),
    __param(0, (0, api_pagination_1.Pagination)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "list", null);
__decorate([
    (0, common_1.Get)(':menuId/role'),
    __param(0, (0, common_1.Param)('menuId', common_1.ParseIntPipe)),
    __param(1, (0, api_pagination_1.Pagination)()),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object, Object]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "listRoles", null);
__decorate([
    (0, common_1.Patch)(':menuId/role'),
    __param(0, (0, common_1.Param)('menuId', common_1.ParseIntPipe)),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, update_ids_dto_1.UpdateIdsDTO, Object]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "updateRoles", null);
__decorate([
    (0, common_1.Get)(':menuId'),
    __param(0, (0, api_locale_1.Locale)()),
    __param(1, (0, common_1.Param)('menuId', common_1.ParseIntPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Number]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "show", null);
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, api_locale_1.Locale)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, create_dto_1.CreateDTO]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "create", null);
__decorate([
    (0, common_1.Patch)('order'),
    __param(0, (0, api_locale_1.Locale)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, order_dto_1.OrderDTO]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "updateOrder", null);
__decorate([
    (0, common_1.Patch)(':menuId'),
    __param(0, (0, api_locale_1.Locale)()),
    __param(1, (0, common_1.Param)('menuId', common_1.ParseIntPipe)),
    __param(2, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Number, update_dto_1.UpdateDTO]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(),
    __param(0, (0, api_locale_1.Locale)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, delete_dto_1.DeleteDTO]),
    __metadata("design:returntype", Promise)
], MenuController.prototype, "delete", null);
exports.MenuController = MenuController = __decorate([
    (0, api_1.Role)(),
    (0, common_1.Controller)('menu'),
    __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => menu_service_1.MenuService))),
    __metadata("design:paramtypes", [menu_service_1.MenuService])
], MenuController);
//# sourceMappingURL=menu.controller.js.map