import { Controller, Get, Post, Body, UseGuards, Request, Query } from '@nestjs/common';
import { StrategicActivitiesService } from './strategic-activities.service';
import { AuthGuard } from '@nestjs/passport';

@Controller('strategic-activities')
@UseGuards(AuthGuard('jwt'))
export class StrategicActivitiesController {
    constructor(private readonly service: StrategicActivitiesService) { }

    @Post()
    create(@Request() req, @Body() data: any) {
        return this.service.create(req.user.id, data);
    }

    @Get()
    findAll(
        @Request() req,
        @Query('startDate') startDate?: string,
        @Query('endDate') endDate?: string,
        @Query('userId') userId?: string,
        @Query('clientId') clientId?: string,
    ) {
        return this.service.findAll(req.user, { startDate, endDate, userId, clientId });
    }

    @Get('stats')
    getStats(@Request() req) {
        return this.service.getStats(req.user.id);
    }
}
