import { Controller, Post, Query, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { SuperAdminJwtAuthGuard } from '../../common/guards/super-admin-jwt-auth.guard';
import { CounterReconciliationService } from './counter-reconciliation.service';

@ApiTags('Operations')
@ApiBearerAuth()
@UseGuards(SuperAdminJwtAuthGuard)
@Controller('internal/maintenance')
export class MaintenanceController {
  constructor(private readonly counters: CounterReconciliationService) {}

  @Post('reconcile-post-counters')
  reconcile(@Query('execute') execute?: string) {
    return execute === 'true' ? this.counters.enqueue() : this.counters.reconcile(true);
  }
}
