import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags, ApiOperation } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { SettingsService } from './settings.service';

@ApiTags('settings')
@Controller('settings')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
export class SettingsController {
    constructor(private readonly settingsService: SettingsService) { }

    @Get('payment-gateways')
    @ApiOperation({ summary: 'Get payment gateway credentials (Asaas, Stripe)' })
    async getPaymentSettings() {
        return this.settingsService.getPaymentSettings();
    }

    @Post('payment-gateways')
    @ApiOperation({ summary: 'Update payment gateway credentials' })
    async updatePaymentSettings(@Body() settings: Record<string, string>) {
        await this.settingsService.updatePaymentSettings(settings);
        return { success: true };
    }
}
