import { Controller, Post, Body } from '@nestjs/common';
import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
import { SetupService } from './setup.service';
import { SetupServerDto } from './dto/setup-server.dto';
import { CurrentTenant } from '../../common/decorators/current-tenant.decorator';

@ApiTags('setup')
@ApiBearerAuth()
@Controller('setup')
export class SetupController {
  constructor(private readonly setupService: SetupService) {}

  @Post('server')
  @ApiOperation({ summary: 'Configure server connection during setup' })
  async setupServer(
    @CurrentTenant() licenseId: string,
    @Body() dto: SetupServerDto,
  ) {
    return this.setupService.setupServer(licenseId, dto);
  }

  @Post('complete')
  @ApiOperation({ summary: 'Mark setup as complete' })
  async completeSetup(@CurrentTenant() licenseId: string) {
    return this.setupService.completeSetup(licenseId);
  }
}
