"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.CustomSnippetsController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const custom_snippets_service_1 = require("./custom-snippets.service");
const custom_snippet_dto_1 = require("./dto/custom-snippet.dto");
const core_entities_1 = require("../core-entities");
let CustomSnippetsController = class CustomSnippetsController {
    constructor(customSnippetsService) {
        this.customSnippetsService = customSnippetsService;
    }
    async create(createCustomSnippetDto) {
        return this.customSnippetsService.create(createCustomSnippetDto);
    }
    async findAll() {
        return this.customSnippetsService.findAll();
    }
    async findOne(id) {
        return this.customSnippetsService.findOne(id);
    }
    async update(id, updateCustomSnippetDto) {
        return this.customSnippetsService.update(id, updateCustomSnippetDto);
    }
    async remove(id) {
        return this.customSnippetsService.remove(id);
    }
    async duplicate(id) {
        return this.customSnippetsService.duplicate(id);
    }
};
exports.CustomSnippetsController = CustomSnippetsController;
__decorate([
    (0, common_1.Post)(),
    (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
    (0, swagger_1.ApiOperation)({ summary: 'Create a custom snippet' }),
    (0, swagger_1.ApiResponse)({
        status: 201,
        description: 'Snippet created',
        type: core_entities_1.CustomSnippet,
    }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [custom_snippet_dto_1.CreateCustomSnippetDto]),
    __metadata("design:returntype", Promise)
], CustomSnippetsController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: 'List all custom snippets' }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'List of snippets',
        type: [core_entities_1.CustomSnippet],
    }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", Promise)
], CustomSnippetsController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: 'Get a custom snippet by ID' }),
    (0, swagger_1.ApiParam)({ name: 'id', description: 'Snippet UUID', format: 'uuid' }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Snippet found',
        type: core_entities_1.CustomSnippet,
    }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Snippet not found' }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], CustomSnippetsController.prototype, "findOne", null);
__decorate([
    (0, common_1.Put)(':id'),
    (0, swagger_1.ApiOperation)({ summary: 'Update a custom snippet' }),
    (0, swagger_1.ApiParam)({ name: 'id', description: 'Snippet UUID', format: 'uuid' }),
    (0, swagger_1.ApiResponse)({
        status: 200,
        description: 'Snippet updated',
        type: core_entities_1.CustomSnippet,
    }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Snippet 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, custom_snippet_dto_1.UpdateCustomSnippetDto]),
    __metadata("design:returntype", Promise)
], CustomSnippetsController.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 custom snippet' }),
    (0, swagger_1.ApiParam)({ name: 'id', description: 'Snippet UUID', format: 'uuid' }),
    (0, swagger_1.ApiResponse)({ status: 204, description: 'Snippet deleted' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Snippet not found' }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], CustomSnippetsController.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 custom snippet' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Snippet UUID to duplicate',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({
        status: 201,
        description: 'Snippet duplicated',
        type: core_entities_1.CustomSnippet,
    }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Snippet not found' }),
    __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], CustomSnippetsController.prototype, "duplicate", null);
exports.CustomSnippetsController = CustomSnippetsController = __decorate([
    (0, swagger_1.ApiTags)('custom-snippets'),
    (0, common_1.Controller)('custom-snippets'),
    __metadata("design:paramtypes", [custom_snippets_service_1.CustomSnippetsService])
], CustomSnippetsController);
//# sourceMappingURL=custom-snippets.controller.js.map