"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.UsersController = void 0;
const common_1 = require("@nestjs/common");
const jwt_auth_guard_1 = require("../common/guards/jwt-auth.guard");
const current_user_decorator_1 = require("../common/decorators/current-user.decorator");
const users_profile_service_1 = require("./users-profile.service");
const update_profile_dto_1 = require("./dto/update-profile.dto");
const update_email_dto_1 = require("./dto/update-email.dto");
const update_notification_prefs_dto_1 = require("./dto/update-notification-prefs.dto");
let UsersController = class UsersController {
    profileService;
    constructor(profileService) {
        this.profileService = profileService;
    }
    getProfile(user) {
        return this.profileService.getProfile(user.id, user.role);
    }
    updateProfile(user, dto) {
        return this.profileService.updateProfile(user.id, user.role, dto);
    }
    updateEmail(user, dto) {
        return this.profileService.updateEmail(user.id, user.role, dto.email);
    }
    updateNotificationPrefs(user, dto) {
        return this.profileService.updateNotificationPrefs(user.id, user.role, dto);
    }
};
exports.UsersController = UsersController;
__decorate([
    (0, common_1.Get)('me/profile'),
    __param(0, (0, current_user_decorator_1.CurrentUser)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", void 0)
], UsersController.prototype, "getProfile", null);
__decorate([
    (0, common_1.Patch)('me/profile'),
    __param(0, (0, current_user_decorator_1.CurrentUser)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, update_profile_dto_1.UpdateProfileDto]),
    __metadata("design:returntype", void 0)
], UsersController.prototype, "updateProfile", null);
__decorate([
    (0, common_1.Patch)('me/email'),
    __param(0, (0, current_user_decorator_1.CurrentUser)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, update_email_dto_1.UpdateEmailDto]),
    __metadata("design:returntype", void 0)
], UsersController.prototype, "updateEmail", null);
__decorate([
    (0, common_1.Patch)('me/notification-prefs'),
    __param(0, (0, current_user_decorator_1.CurrentUser)()),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, update_notification_prefs_dto_1.UpdateNotificationPrefsDto]),
    __metadata("design:returntype", void 0)
], UsersController.prototype, "updateNotificationPrefs", null);
exports.UsersController = UsersController = __decorate([
    (0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
    (0, common_1.Controller)('users'),
    __metadata("design:paramtypes", [users_profile_service_1.UsersProfileService])
], UsersController);
//# sourceMappingURL=users.controller.js.map