"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.AgentsController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const agents_service_1 = require("./agents.service");
const create_agent_dto_1 = require("./dto/create-agent.dto");
const update_agent_dto_1 = require("./dto/update-agent.dto");
let AgentsController = class AgentsController {
    constructor(agentsService) {
        this.agentsService = agentsService;
    }
    create(createAgentDto) {
        return this.agentsService.create(createAgentDto);
    }
    findAll(activeOnly) {
        return this.agentsService.findAll(activeOnly);
    }
    findDefault() {
        return this.agentsService.findDefault();
    }
    findOne(id) {
        return this.agentsService.findOne(id);
    }
    update(id, updateAgentDto) {
        return this.agentsService.update(id, updateAgentDto);
    }
    remove(id) {
        return this.agentsService.remove(id);
    }
    setDefault(id) {
        return this.agentsService.setDefault(id);
    }
    async duplicate(id) {
        return this.agentsService.duplicate(id);
    }
};
exports.AgentsController = AgentsController;
__decorate([
    (0, common_1.Post)(),
    (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
    (0, swagger_1.ApiOperation)({ summary: 'Create an agent' }),
    (0, swagger_1.ApiResponse)({ status: 201, description: 'Agent created' }),
    __param(0, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [create_agent_dto_1.CreateAgentDto]),
    __metadata("design:returntype", void 0)
], AgentsController.prototype, "create", null);
__decorate([
    (0, common_1.Get)(),
    (0, swagger_1.ApiOperation)({ summary: 'List agents (optional filter by active)' }),
    (0, swagger_1.ApiQuery)({
        name: 'activeOnly',
        required: false,
        description: 'Filter to only active agents',
        type: Boolean,
    }),
    (0, swagger_1.ApiResponse)({ status: 200, description: 'List of agents' }),
    __param(0, (0, common_1.Query)('activeOnly')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean]),
    __metadata("design:returntype", void 0)
], AgentsController.prototype, "findAll", null);
__decorate([
    (0, common_1.Get)('default'),
    (0, swagger_1.ApiOperation)({ summary: 'Get the default agent' }),
    (0, swagger_1.ApiResponse)({ status: 200, description: 'Default agent' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'No default agent found' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], AgentsController.prototype, "findDefault", null);
__decorate([
    (0, common_1.Get)(':id'),
    (0, swagger_1.ApiOperation)({ summary: 'Get an agent by ID' }),
    (0, swagger_1.ApiParam)({ name: 'id', description: 'Agent UUID', format: 'uuid' }),
    (0, swagger_1.ApiResponse)({ status: 200, description: 'Agent found' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Agent not found' }),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], AgentsController.prototype, "findOne", null);
__decorate([
    (0, common_1.Patch)(':id'),
    (0, swagger_1.ApiOperation)({ summary: 'Update an agent' }),
    (0, swagger_1.ApiParam)({ name: 'id', description: 'Agent UUID', format: 'uuid' }),
    (0, swagger_1.ApiResponse)({ status: 200, description: 'Agent updated' }),
    (0, swagger_1.ApiResponse)({ status: 403, description: 'Cannot modify built-in agent' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Agent not found' }),
    __param(0, (0, common_1.Param)('id')),
    __param(1, (0, common_1.Body)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, update_agent_dto_1.UpdateAgentDto]),
    __metadata("design:returntype", void 0)
], AgentsController.prototype, "update", null);
__decorate([
    (0, common_1.Delete)(':id'),
    (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
    (0, swagger_1.ApiOperation)({ summary: 'Delete an agent' }),
    (0, swagger_1.ApiParam)({ name: 'id', description: 'Agent UUID', format: 'uuid' }),
    (0, swagger_1.ApiResponse)({ status: 204, description: 'Agent deleted' }),
    (0, swagger_1.ApiResponse)({ status: 403, description: 'Cannot delete built-in agent' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Agent not found' }),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], AgentsController.prototype, "remove", null);
__decorate([
    (0, common_1.Post)(':id/set-default'),
    (0, swagger_1.ApiOperation)({ summary: 'Set an agent as the default' }),
    (0, swagger_1.ApiParam)({ name: 'id', description: 'Agent UUID', format: 'uuid' }),
    (0, swagger_1.ApiResponse)({ status: 200, description: 'Agent set as default' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Agent not found' }),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], AgentsController.prototype, "setDefault", null);
__decorate([
    (0, common_1.Post)(':id/duplicate'),
    (0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
    (0, swagger_1.ApiOperation)({ summary: 'Duplicate an agent' }),
    (0, swagger_1.ApiParam)({
        name: 'id',
        description: 'Agent UUID to duplicate',
        format: 'uuid',
    }),
    (0, swagger_1.ApiResponse)({ status: 201, description: 'Agent duplicated' }),
    (0, swagger_1.ApiResponse)({ status: 404, description: 'Agent not found' }),
    __param(0, (0, common_1.Param)('id')),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", Promise)
], AgentsController.prototype, "duplicate", null);
exports.AgentsController = AgentsController = __decorate([
    (0, swagger_1.ApiTags)('agents'),
    (0, common_1.Controller)('agents'),
    __metadata("design:paramtypes", [agents_service_1.AgentsService])
], AgentsController);
//# sourceMappingURL=agents.controller.js.map