"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);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoreNotificationsMcpTools = void 0;
const common_1 = require("@nestjs/common");
const notification_service_1 = require("../../notification/notification.service");
const mcp_tool_decorator_1 = require("../decorators/mcp-tool.decorator");
let CoreNotificationsMcpTools = class CoreNotificationsMcpTools {
    constructor(notificationService) {
        this.notificationService = notificationService;
    }
    async listNotifications(args, context) {
        var _a, _b;
        return this.notificationService.list(context.userId, {
            page: (_a = args.page) !== null && _a !== void 0 ? _a : 1,
            pageSize: (_b = args.pageSize) !== null && _b !== void 0 ? _b : 20,
            search: '',
            sortField: 'id',
            sortOrder: 'desc',
            fields: '',
        });
    }
    async getUnreadCount(_args, context) {
        return this.notificationService.unreadCount(context.userId);
    }
    async markRead(args, context) {
        return this.notificationService.markRead(context.userId, args.id);
    }
    async markAllRead(_args, context) {
        return this.notificationService.markAllRead(context.userId);
    }
    async createNotification(args, _context) {
        return this.notificationService.create(args);
    }
    async deleteNotification(args, context) {
        return this.notificationService.delete(context.userId, args.id);
    }
    async deleteAllNotifications(_args, context) {
        return this.notificationService.deleteAll(context.userId);
    }
    async updateProgress(args, context) {
        return this.notificationService.updateProgress(context.userId, args.id, {
            progress: args.progress,
            success: args.status === 'failed' ? false : args.status === 'completed' ? true : undefined,
        });
    }
};
exports.CoreNotificationsMcpTools = CoreNotificationsMcpTools;
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.list',
        description: 'Lists notifications for the authenticated user.',
        inputSchema: {
            type: 'object',
            properties: {
                page: { type: 'number', description: 'Page number (default: 1)' },
                pageSize: { type: 'number', description: 'Items per page (default: 20)' },
            },
        },
        readOnly: true,
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "listNotifications", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.unread-count',
        description: 'Returns the unread notification count for the authenticated user.',
        inputSchema: { type: 'object', properties: {} },
        readOnly: true,
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "getUnreadCount", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.mark-read',
        description: 'Marks a specific notification as read.',
        inputSchema: {
            type: 'object',
            properties: {
                id: { type: 'number', description: 'Notification ID' },
            },
            required: ['id'],
        },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "markRead", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.mark-all-read',
        description: 'Marks all notifications as read for the authenticated user.',
        inputSchema: { type: 'object', properties: {} },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "markAllRead", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.create',
        description: 'Creates a new notification for a user. Admin only.',
        inputSchema: {
            type: 'object',
            properties: {
                userId: { type: 'number', description: 'Target user ID' },
                title: { type: 'string', description: 'Notification title' },
                message: { type: 'string', description: 'Notification message' },
                type: { type: 'string', description: 'Notification type (e.g. info, success, error)' },
            },
            required: ['userId', 'title', 'message'],
        },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "createNotification", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.delete',
        description: 'Deletes a specific notification for the authenticated user.',
        inputSchema: {
            type: 'object',
            properties: {
                id: { type: 'number', description: 'Notification ID' },
            },
            required: ['id'],
        },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "deleteNotification", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.delete-all',
        description: 'Deletes all notifications for the authenticated user.',
        inputSchema: { type: 'object', properties: {} },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "deleteAllNotifications", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.notifications.update-progress',
        description: 'Updates the progress of a notification (e.g. for background job tracking).',
        inputSchema: {
            type: 'object',
            properties: {
                id: { type: 'number', description: 'Notification ID' },
                progress: { type: 'number', description: 'Progress value (0-100)' },
                status: { type: 'string', description: 'Status (e.g. in_progress, completed, failed)' },
            },
            required: ['id', 'progress'],
        },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreNotificationsMcpTools.prototype, "updateProgress", null);
exports.CoreNotificationsMcpTools = CoreNotificationsMcpTools = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [notification_service_1.NotificationService])
], CoreNotificationsMcpTools);
//# sourceMappingURL=core-notifications.mcp-tools.js.map