import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { FollowupsService } from './followups.service';
import { CreateFollowupDto } from './dto/create-followup.dto';

@Controller('followups')
export class FollowupsController {
    constructor(private readonly followupsService: FollowupsService) { }

    @Post()
    create(@Body() createFollowupDto: CreateFollowupDto) {
        return this.followupsService.create(createFollowupDto);
    }

    @Get()
    findAll(
        @Query('userId') userId?: string,
        @Query('clientId') clientId?: string,
        @Query('dateFrom') dateFrom?: string,
        @Query('dateTo') dateTo?: string,
        @Query('status') status?: string,
        @Query('opportunityId') opportunityId?: string,
        @Query('enquiryId') enquiryId?: string,
    ) {
        return this.followupsService.findAll({ userId, clientId, dateFrom, dateTo, status, opportunityId, enquiryId });
    }

    @Get(':id')
    findOne(@Param('id') id: string) {
        return this.followupsService.findOne(id);
    }

    @Patch(':id')
    update(@Param('id') id: string, @Body() updateFollowupDto: any) {
        return this.followupsService.update(id, updateFollowupDto);
    }

    @Delete(':id')
    remove(@Param('id') id: string) {
        return this.followupsService.remove(id);
    }
}
