import { Controller, Get, Put, Body, UseGuards } from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { TenantsService } from './tenants.service';
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
import { CurrentTenant } from '../../common/decorators/tenant.decorator';

@ApiTags('Tenant')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Controller('tenant')
export class TenantsController {
  constructor(private service: TenantsService) {}

  @Get()
  findOne(@CurrentTenant() tenantId: string) { return this.service.findOne(tenantId); }

  @Put('settings')
  update(@CurrentTenant() tenantId: string, @Body() body: any) {
    return this.service.updateSettings(tenantId, body);
  }
}
