"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.ContextTemplatesController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const context_templates_service_1 = require("./context-templates.service");
const context_template_dto_1 = require("./dto/context-template.dto");
const core_entities_1 = require("../core-entities");
const context_template_entity_1 = require("../core-entities/context-template.entity");
let ContextTemplatesController = class ContextTemplatesController {
    constructor(contextTemplatesService) {
        this.contextTemplatesService = contextTemplatesService;
    }
    async create(createContextTemplateDto) {
        return this.contextTemplatesService.create(createContextTemplateDto);
    }
    async preview(previewDto) {
        return this.contextTemplatesService.preview(previewDto);
    }
    async findAll(type) {
        return this.contextTemplatesService.findAll(type);
    }
    async findOne(id) {
        return this.contextTemplatesService.findOne(id);
    }
    async update(id, updateContextTemplateDto) {
        return this.contextTemplatesService.update(id, updateContextTemplateDto);
    }
    async remove(id) {
        return this.contextTemplatesService.remove(id);
    }
    async duplicate(id) {
        return this.contextTemplatesService.duplicate(id);
    }
    async setDefaultInitial(id) {
        return this.contextTemplatesService.setDefaultInitial(id);
    }
    async setDefaultFollowup(id) {
        return this.contextTemplatesService.setDefaultFollowup(id);
    }
    async setDefaultCondensed(id) {
        return this.contextTemplatesService.setDefaultCondensed(id);
    }
};
exports.ContextTemplatesController = ContextTemplatesController;
__decorate([
    (0, common_1.Post)(),
    (0, swagger_1.ApiOperation)({ summary: 'Create a new context template' }),
    (0, swagger_1.ApiResponse)({
        status: 201,
        description: 'Context template created',
        type: core_entities_1.ContextTemplate,
    }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [context_template_dto_1.CreateContextTemplateDto]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "create", null);
__decorate([
    (0, common_1.Post)('preview'),
    (0, common_1.HttpCode)(common_1.HttpStatus.OK),
    (0, swagger_1.ApiOperation)({ summary: 'Preview rendered context template' }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Rendered context',
        type: context_template_dto_1.PreviewContextTemplateResponseDto,
    }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [context_template_dto_1.PreviewContextTemplateDto]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "preview", null);
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: 'List all context templates (filter by type)' }),
    (0, swagger_1.ApiQuery)({
        name: 'type',
        required: false,
        description: 'Filter by template type',
        enum: context_template_entity_1.TemplateType,
    }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'List of context templates',
        type: [core_entities_1.ContextTemplate],
    }),
    __param(0, (0, common_1.Query)('type')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: 'Get a context template by ID' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Context template UUID',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Context template found',
        type: core_entities_1.ContextTemplate,
    }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Context template not found' }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "findOne", null);
__decorate([
    (0, common_1.Put)(':id'),
    (0, swagger_1.ApiOperation)({ summary: 'Update a context template' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Context template UUID',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Context template updated',
        type: core_entities_1.ContextTemplate,
    }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Context template not found' }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, context_template_dto_1.UpdateContextTemplateDto]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
    (0, swagger_1.ApiOperation)({ summary: 'Delete a context template' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Context template UUID',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({ status: 204, description: 'Context template deleted' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Context template not found' }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "remove", null);
__decorate([
    (0, common_1.Post)(':id/duplicate'),
    (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
    (0, swagger_1.ApiOperation)({ summary: 'Duplicate a context template' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Context template UUID to duplicate',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({
        status: 201,
        description: 'Template duplicated',
        type: core_entities_1.ContextTemplate,
    }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Context template not found' }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "duplicate", null);
__decorate([
    (0, common_1.Post)(':id/set-default-initial'),
    (0, common_1.HttpCode)(common_1.HttpStatus.OK),
    (0, swagger_1.ApiOperation)({ summary: 'Set as default for initial prompts' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Context template UUID',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Set as default initial',
        type: core_entities_1.ContextTemplate,
    }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "setDefaultInitial", null);
__decorate([
    (0, common_1.Post)(':id/set-default-followup'),
    (0, common_1.HttpCode)(common_1.HttpStatus.OK),
    (0, swagger_1.ApiOperation)({ summary: 'Set as default for follow-up prompts' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Context template UUID',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Set as default followup',
        type: core_entities_1.ContextTemplate,
    }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "setDefaultFollowup", null);
__decorate([
    (0, common_1.Post)(':id/set-default-condensed'),
    (0, common_1.HttpCode)(common_1.HttpStatus.OK),
    (0, swagger_1.ApiOperation)({ summary: 'Set as default for condensed history' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Context template UUID',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Set as default condensed',
        type: core_entities_1.ContextTemplate,
    }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], ContextTemplatesController.prototype, "setDefaultCondensed", null);
exports.ContextTemplatesController = ContextTemplatesController = __decorate([
    (0, swagger_1.ApiTags)('context-templates'),
    (0, common_1.Controller)('context-templates'),
    __metadata("design:paramtypes", [context_templates_service_1.ContextTemplatesService])
], ContextTemplatesController);
//# sourceMappingURL=context-templates.controller.js.map