"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.RoleController = 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 update_dto_1 = require("./dto/update.dto");
const role_service_1 = require("./role.service");
let RoleController = class RoleController {
    constructor(roleService) {
        this.roleService = roleService;
    }
    async list(paginationParams, locale) {
        return this.roleService.list(paginationParams, locale);
    }
    async listUsers(paginationParams, roleId) {
        return this.roleService.listUsers(roleId, paginationParams);
    }
    async listMenus(paginationParams, roleId, locale) {
        return this.roleService.listMenus(locale, roleId, paginationParams);
    }
    async listRoutes(paginationParams, roleId, search, searchType, method) {
        return this.roleService.listRoutes(roleId, paginationParams, search, searchType, method);
    }
    async listScreens(paginationParams, roleId, locale) {
        return this.roleService.listScreens(locale, roleId, paginationParams);
    }
    async updateUsers(roleId, data) {
        return this.roleService.updateUsers(roleId, data);
    }
    async updateMenus(roleId, data) {
        return this.roleService.updateMenus(roleId, data);
    }
    async updateRoutes(roleId, data) {
        return this.roleService.updateRoutes(roleId, data);
    }
    async updateScreens(roleId, data) {
        return this.roleService.updateScreens(roleId, data);
    }
    async show(roleId) {
        return this.roleService.get(roleId);
    }
    async create(data) {
        return this.roleService.create(data);
    }
    async update(roleId, data, locale) {
        return this.roleService.update(roleId, data, locale);
    }
    async delete(data, locale) {
        return this.roleService.delete(data, locale);
    }
};
exports.RoleController = RoleController;
__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)
], RoleController.prototype, "list", null);
__decorate([
    (0, common_1.Get)(':roleId/user'),
    __param(0, (0, api_pagination_1.Pagination)()),
    __param(1, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Number]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "listUsers", null);
__decorate([
    (0, common_1.Get)(':roleId/menu'),
    __param(0, (0, api_pagination_1.Pagination)()),
    __param(1, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Number, Object]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "listMenus", null);
__decorate([
    (0, common_1.Get)(':roleId/route'),
    __param(0, (0, api_pagination_1.Pagination)()),
    __param(1, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __param(2, (0, common_1.Query)('search')),
    __param(3, (0, common_1.Query)('searchType')),
    __param(4, (0, common_1.Query)('method')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Number, String, String, String]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "listRoutes", null);
__decorate([
    (0, common_1.Get)(':roleId/screen'),
    __param(0, (0, api_pagination_1.Pagination)()),
    __param(1, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __param(2, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Number, Object]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "listScreens", null);
__decorate([
    (0, common_1.Patch)(':roleId/user'),
    __param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, update_ids_dto_1.UpdateIdsDTO]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "updateUsers", null);
__decorate([
    (0, common_1.Patch)(':roleId/menu'),
    __param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, update_ids_dto_1.UpdateIdsDTO]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "updateMenus", null);
__decorate([
    (0, common_1.Patch)(':roleId/route'),
    __param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, update_ids_dto_1.UpdateIdsDTO]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "updateRoutes", null);
__decorate([
    (0, common_1.Patch)(':roleId/screen'),
    __param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, update_ids_dto_1.UpdateIdsDTO]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "updateScreens", null);
__decorate([
    (0, common_1.Get)(':roleId'),
    __param(0, (0, common_1.Param)('roleId', common_1.ParseIntPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "show", null);
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [create_dto_1.CreateDTO]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "create", null);
__decorate([
    (0, common_1.Patch)(':roleId'),
    __param(0, (0, common_1.Param)('roleId', 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_dto_1.UpdateDTO, Object]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [delete_dto_1.DeleteDTO, Object]),
    __metadata("design:returntype", Promise)
], RoleController.prototype, "delete", null);
exports.RoleController = RoleController = __decorate([
    (0, api_1.Role)(),
    (0, common_1.Controller)('role'),
    __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => role_service_1.RoleService))),
    __metadata("design:paramtypes", [role_service_1.RoleService])
], RoleController);
//# sourceMappingURL=role.controller.js.map