"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.RouteController = 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 route_service_1 = require("./route.service");
let RouteController = class RouteController {
    constructor(routeService) {
        this.routeService = routeService;
    }
    async list(paginationParams) {
        return this.routeService.list(paginationParams);
    }
    async get(routeId, locale) {
        return this.routeService.get(routeId, locale);
    }
    async create({ url, method }, locale) {
        return this.routeService.create({ url, method }, locale);
    }
    async update(routeId, data, locale) {
        return this.routeService.update({ id: routeId, data }, locale);
    }
    async delete(data, locale) {
        return this.routeService.delete(data, locale);
    }
    async listRoles(routeId, paginationParams, locale) {
        return this.routeService.listRoles(locale, routeId, paginationParams);
    }
    async updateRoles(routeId, data) {
        return this.routeService.updateRoles(routeId, data);
    }
    async listScreens(routeId, paginationParams, locale) {
        return this.routeService.listScreens(locale, routeId, paginationParams);
    }
    async updateScreens(routeId, data) {
        return this.routeService.updateScreens(routeId, data);
    }
};
exports.RouteController = RouteController;
__decorate([
    (0, common_1.Get)(),
    __param(0, (0, api_pagination_1.Pagination)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], RouteController.prototype, "list", null);
__decorate([
    (0, common_1.Get)(':routeId'),
    __param(0, (0, common_1.Param)('routeId', common_1.ParseIntPipe)),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Object]),
    __metadata("design:returntype", Promise)
], RouteController.prototype, "get", null);
__decorate([
    (0, common_1.Post)(),
    __param(0, (0, common_1.Body)()),
    __param(1, (0, api_locale_1.Locale)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [create_dto_1.CreateDTO, Object]),
    __metadata("design:returntype", Promise)
], RouteController.prototype, "create", null);
__decorate([
    (0, common_1.Patch)(':routeId'),
    __param(0, (0, common_1.Param)('routeId', 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)
], RouteController.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)
], RouteController.prototype, "delete", null);
__decorate([
    (0, common_1.Get)(':routeId/role'),
    __param(0, (0, common_1.Param)('routeId', 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, api_pagination_1.PaginationDTO, Object]),
    __metadata("design:returntype", Promise)
], RouteController.prototype, "listRoles", null);
__decorate([
    (0, common_1.Patch)(':routeId/role'),
    __param(0, (0, common_1.Param)('routeId', 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)
], RouteController.prototype, "updateRoles", null);
__decorate([
    (0, common_1.Get)(':routeId/screen'),
    __param(0, (0, common_1.Param)('routeId', 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, api_pagination_1.PaginationDTO, Object]),
    __metadata("design:returntype", Promise)
], RouteController.prototype, "listScreens", null);
__decorate([
    (0, common_1.Patch)(':routeId/screen'),
    __param(0, (0, common_1.Param)('routeId', 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)
], RouteController.prototype, "updateScreens", null);
exports.RouteController = RouteController = __decorate([
    (0, api_1.Role)(),
    (0, common_1.Controller)('route'),
    __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => route_service_1.RouteService))),
    __metadata("design:paramtypes", [route_service_1.RouteService])
], RouteController);
//# sourceMappingURL=route.controller.js.map