import { Controller, Get, Post, Body, UseGuards, Req } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
import { AuthGuard } from '@nestjs/passport';
import { KycService } from '../../../application/services/kyc.service';
import { KycSubmitDto } from '../dto/kyc-submit.dto';

@ApiTags('KYC')
@Controller('users/kyc')
export class KycController {
  constructor(private readonly kycService: KycService) {}

  @Post()
  @UseGuards(AuthGuard('jwt'))
  @ApiBearerAuth()
  @ApiOperation({ summary: 'Submit KYC application' })
  async submitKyc(@Req() req: any, @Body() dto: KycSubmitDto) {
    const result = await this.kycService.submitKyc(req.user.id, dto);
    return { code: 0, data: result, message: 'KYC submission received' };
  }

  @Get()
  @UseGuards(AuthGuard('jwt'))
  @ApiBearerAuth()
  @ApiOperation({ summary: 'Get KYC status and submissions' })
  async getKycStatus(@Req() req: any) {
    const result = await this.kycService.getKycStatus(req.user.id);
    return { code: 0, data: result };
  }
}
