import { Body, Controller, Param, Post, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { Roles } from '../auth/decorators/roles.decorator';
import { JwtAuthGuard } from '../auth/guards/auth.guard';
import { OrgRolesGuard } from '../auth/guards/org-roles.guard';
import { SimPublishPointDto } from './dto/sim.dto';
import { SimService } from './sim.service';

// JWT-only: this is a UI-driven testing tool, not a public integration surface.
@ApiTags('simulator')
@ApiBearerAuth('jwt')
@Controller('orgs/:orgId/sim')
@UseGuards(JwtAuthGuard, OrgRolesGuard)
@Roles('MEMBER')
export class SimController {
  constructor(private readonly simService: SimService) {}

  @Post('publish')
  publish(@Param('orgId') orgId: string, @Body() dto: SimPublishPointDto) {
    return this.simService.publish(orgId, dto);
  }
}
