"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.CoreDashboardItemsMcpTools = void 0;
const common_1 = require("@nestjs/common");
const dashboard_item_service_1 = require("../../dashboard/dashboard-item/dashboard-item.service");
const mcp_tool_decorator_1 = require("../decorators/mcp-tool.decorator");
let CoreDashboardItemsMcpTools = class CoreDashboardItemsMcpTools {
    constructor(dashboardItemService) {
        this.dashboardItemService = dashboardItemService;
    }
    async listDashboardItems(args, context) {
        var _a, _b;
        return this.dashboardItemService.getAllDashboardItems({ page: (_a = args.page) !== null && _a !== void 0 ? _a : 1, pageSize: (_b = args.pageSize) !== null && _b !== void 0 ? _b : 20, search: '', sortField: 'id', sortOrder: 'asc', fields: '' }, context.locale, args.dashboardId);
    }
    async createDashboardItem(args, context) {
        return this.dashboardItemService.createDashboardItem(args, context.locale);
    }
    async deleteDashboardItem(args, context) {
        return this.dashboardItemService.deleteDashboardItem(args.id, context.locale);
    }
};
exports.CoreDashboardItemsMcpTools = CoreDashboardItemsMcpTools;
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.dashboard-items.list',
        description: 'Lists dashboard items, optionally filtered by dashboard ID. Admin only.',
        inputSchema: {
            type: 'object',
            properties: {
                page: { type: 'number', description: 'Page number (default: 1)' },
                pageSize: { type: 'number', description: 'Items per page (default: 20)' },
                dashboardId: { type: 'number', description: 'Filter by dashboard ID' },
            },
        },
        readOnly: true,
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreDashboardItemsMcpTools.prototype, "listDashboardItems", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.dashboard-items.create',
        description: 'Creates a new dashboard item (widget placement). Admin only.',
        inputSchema: {
            type: 'object',
            properties: {
                dashboardId: { type: 'number', description: 'Dashboard ID' },
                componentId: { type: 'number', description: 'Component ID' },
                position: { type: 'object', description: 'Position/layout config (x, y, w, h)' },
                config: { type: 'object', description: 'Component configuration' },
            },
            required: ['dashboardId', 'componentId'],
        },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreDashboardItemsMcpTools.prototype, "createDashboardItem", null);
__decorate([
    (0, mcp_tool_decorator_1.McpTool)({
        name: 'core.dashboard-items.delete',
        description: 'Deletes a dashboard item by ID. Admin only.',
        inputSchema: {
            type: 'object',
            properties: {
                id: { type: 'number', description: 'Dashboard item ID' },
            },
            required: ['id'],
        },
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], CoreDashboardItemsMcpTools.prototype, "deleteDashboardItem", null);
exports.CoreDashboardItemsMcpTools = CoreDashboardItemsMcpTools = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [dashboard_item_service_1.DashboardItemService])
], CoreDashboardItemsMcpTools);
//# sourceMappingURL=core-dashboard-items.mcp-tools.js.map