"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.MapRefinementController = void 0; const common_1 = require("@nestjs/common"); const swagger_1 = require("@nestjs/swagger"); const telemetry_analyzer_service_1 = require("./telemetry-analyzer.service"); const api_key_guard_1 = require("../common/guards/api-key.guard"); let MapRefinementController = class MapRefinementController { analyzerService; constructor(analyzerService) { this.analyzerService = analyzerService; } async getSummary() { return this.analyzerService.getAnalysisSummary(); } async syncExternal() { return this.analyzerService.syncExternalData(); } async refreshCache() { return this.analyzerService.refreshTrafficCache(); } async analyzeRoadSpeeds(hours) { const sinceHours = hours ? Number(hours) : 24; return this.analyzerService.analyzeRoadSpeeds(sinceHours); } async discoverNewRoads(hours) { const sinceHours = hours ? Number(hours) : 168; return this.analyzerService.discoverNewRoads(sinceHours); } async getCandidates(status) { return this.analyzerService.getCandidates(status || 'pending'); } async discoverClosures(hours) { return this.analyzerService.discoverRoadClosures(hours || 48); } async getClosures() { return this.analyzerService.getClosures(); } async getCongestionData(north, south, east, west) { if (!north || !south || !east || !west) { throw new common_1.HttpException('Bounds required: north, south, east, west / يجب تحديد الحدود الجغرافية', common_1.HttpStatus.BAD_REQUEST); } return this.analyzerService.getCongestionData({ north: Number(north), south: Number(south), east: Number(east), west: Number(west), }); } async approveCandidate(id) { return this.analyzerService.updateCandidateStatus(id, 'approved'); } async rejectCandidate(id) { return this.analyzerService.updateCandidateStatus(id, 'rejected'); } }; exports.MapRefinementController = MapRefinementController; __decorate([ (0, common_1.Get)('summary'), (0, swagger_1.ApiOperation)({ summary: 'Get analysis summary 📊 / ملخص التحليل' }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "getSummary", null); __decorate([ (0, common_1.Post)('sync-external'), (0, swagger_1.ApiOperation)({ summary: 'Sync telemetry from external server 📡 / مزامنة البيانات الخارجية' }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "syncExternal", null); __decorate([ (0, common_1.Post)('refresh-cache'), (0, swagger_1.ApiOperation)({ summary: 'Refresh Redis traffic snapshot 🚀 / تحديث ذاكرة التخزين' }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "refreshCache", null); __decorate([ (0, common_1.Post)('analyze-speeds'), (0, swagger_1.ApiOperation)({ summary: 'Run road speed analysis 🚗 / تشغيل تحليل سرعات الطرق' }), (0, swagger_1.ApiQuery)({ name: 'hours', required: false, description: 'Hours to look back (default: 24)' }), __param(0, (0, common_1.Query)('hours')), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "analyzeRoadSpeeds", null); __decorate([ (0, common_1.Post)('discover-roads'), (0, swagger_1.ApiOperation)({ summary: 'Discover new roads from telemetry 🛣️ / اكتشاف طرق جديدة' }), (0, swagger_1.ApiQuery)({ name: 'hours', required: false, description: 'Hours to look back (default: 168 = 1 week)' }), __param(0, (0, common_1.Query)('hours')), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "discoverNewRoads", null); __decorate([ (0, common_1.Get)('candidates'), (0, swagger_1.ApiOperation)({ summary: 'Get list of candidate roads / جلب الطرق المرشحة' }), (0, swagger_1.ApiQuery)({ name: 'status', required: false, enum: ['pending', 'approved', 'rejected'] }), __param(0, (0, common_1.Query)('status')), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "getCandidates", null); __decorate([ (0, common_1.Post)('discover-closures'), (0, swagger_1.ApiOperation)({ summary: 'Run road closure detection 🚧 / تشغيل كشف الإغلاقات' }), (0, swagger_1.ApiQuery)({ name: 'hours', required: false, description: 'Hours to look back (default: 48)' }), __param(0, (0, common_1.Query)('hours')), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "discoverClosures", null); __decorate([ (0, common_1.Get)('closures'), (0, swagger_1.ApiOperation)({ summary: 'Get currently detected closures / جلب الإغلاقات المكتشفة' }), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "getClosures", null); __decorate([ (0, common_1.Get)('congestion'), (0, swagger_1.ApiOperation)({ summary: 'Get congestion data for heatmap 🗺️ / بيانات الازدحام' }), (0, swagger_1.ApiQuery)({ name: 'north', required: true }), (0, swagger_1.ApiQuery)({ name: 'south', required: true }), (0, swagger_1.ApiQuery)({ name: 'east', required: true }), (0, swagger_1.ApiQuery)({ name: 'west', required: true }), __param(0, (0, common_1.Query)('north')), __param(1, (0, common_1.Query)('south')), __param(2, (0, common_1.Query)('east')), __param(3, (0, common_1.Query)('west')), __metadata("design:type", Function), __metadata("design:paramtypes", [Number, Number, Number, Number]), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "getCongestionData", null); __decorate([ (0, common_1.Patch)('candidates/:id/approve'), (0, swagger_1.ApiOperation)({ summary: 'Approve a candidate road ✅ / الموافقة على طريق مرشح' }), __param(0, (0, common_1.Param)('id')), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "approveCandidate", null); __decorate([ (0, common_1.Patch)('candidates/:id/reject'), (0, swagger_1.ApiOperation)({ summary: 'Reject a candidate road ❌ / رفض طريق مرشح' }), __param(0, (0, common_1.Param)('id')), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise) ], MapRefinementController.prototype, "rejectCandidate", null); exports.MapRefinementController = MapRefinementController = __decorate([ (0, swagger_1.ApiTags)('map-refinement'), (0, common_1.Controller)('map-refinement'), (0, common_1.UseGuards)(api_key_guard_1.ApiKeyGuard), __metadata("design:paramtypes", [telemetry_analyzer_service_1.TelemetryAnalyzerService]) ], MapRefinementController); //# sourceMappingURL=map-refinement.controller.js.map