import { Body, Controller, Get, Patch, UseGuards } from '@nestjs/common';
import { Roles } from '../common/decorators/roles.decorator';
import { JwtAuthGuard } from '../common/guards/jwt-auth.guard';
import { RolesGuard } from '../common/guards/roles.guard';
import { AdminService } from './admin.service';

@Controller('admin')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('ADMIN', 'SUPER_ADMIN')
export class AdminController {
  constructor(private readonly adminService: AdminService) {}

  @Get('overview')
  getOverview() {
    return this.adminService.getOverview();
  }

  @Get('live-map')
  getLiveMap() {
    return this.adminService.getLiveMap();
  }

  @Get('delivery-settings')
  getDeliverySettings() {
    return this.adminService.getDeliverySettings();
  }

  @Patch('delivery-settings')
  updateDeliverySettings(@Body() body: Record<string, unknown>) {
    return this.adminService.updateDeliverySettings(body);
  }
}
