import { Controller, Get } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';

@ApiTags('健康检查')
@Controller('health')
export class HealthController {
  constructor(private readonly prisma: PrismaService) {}

  @Get()
  @ApiOperation({ summary: '健康检查' })
  async check(): Promise<{ status: string; service: string; timestamp: string }> {
    // 检查数据库连接
    await this.prisma.$queryRaw`SELECT 1`;

    return {
      status: 'ok',
      service: 'transfer-service',
      timestamp: new Date().toISOString(),
    };
  }
}
