import { Controller, Post, Delete, UseGuards, Body } from '@nestjs/common';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { RolesGuard } from '../auth/guards/roles.guard';
import { Roles } from '../auth/decorators/roles.decorator';
import { SeedService } from './seed.service';

@Controller('seed')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('ADMINISTRATOR')
export class SeedController {
  constructor(private readonly seedService: SeedService) {}

  /**
   * Generate all test data in a single fast transaction
   */
  @Post('generate')
  async generateTestData(@Body() options?: { clearFirst?: boolean }) {
    return this.seedService.generateAllTestData(options?.clearFirst ?? true);
  }

  /**
   * Clear all test data instantly
   */
  @Delete('clear')
  async clearAllData() {
    return this.seedService.clearAllData();
  }

  /**
   * Generate only events with dynamic times (keeps existing VIPs/drivers/vehicles)
   */
  @Post('generate-events')
  async generateDynamicEvents() {
    return this.seedService.generateDynamicEvents();
  }
}
