import { Body, Controller, Get, Param, Patch, UseGuards } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { LiveService } from './live.service';
import { UpdateLiveStatusDto } from './live.dto';
import { JwtGuard } from '../../common/jwt.guard';

@ApiTags('Live Tracking')
@Controller('live')
export class LiveController {
  constructor(private service: LiveService) {}
  @Get('schedules/:scheduleId')          @ApiOperation({ summary: 'Get live status for a schedule' })              getTripLiveStatus(@Param('scheduleId') id: string) { return this.service.getTripLiveStatus(id); }
  @Get('schedules/:scheduleId/stops')    @ApiOperation({ summary: 'Get stop timeline for a schedule' })            getStopTimeline(@Param('scheduleId') id: string) { return this.service.getStopTimeline(id); }
  @Patch('schedules/:scheduleId/status') @UseGuards(JwtGuard) @ApiBearerAuth('JWT-auth') @ApiOperation({ summary: 'Update live schedule status (staff/system)' }) updateLiveStatus(@Param('scheduleId') id: string, @Body() dto: UpdateLiveStatusDto) { return this.service.updateLiveStatus(id, dto); }
  @Get('crowd-signals')         @ApiOperation({ summary: 'Get station crowd signals' })               getCrowdSignals() { return this.service.getStationCrowdSignals(); }
  @Get('weather-alerts')        @ApiOperation({ summary: 'Get active weather alerts' })               getWeatherAlerts() { return this.service.getWeatherAlerts(); }
}
