import { Controller, Get } from "@nestjs/common";

const SERVICE_NAME = "teacher-bff";

/**
 * 健康检查端点。
 *
 * - GET /healthz：liveness，仅返回进程存活。
 * - GET /readyz：readiness，BFF 不直接访问 DB，可直接返回 ok。
 *
 * 不需要鉴权，必须在路由白名单中放行。
 */
@Controller()
export class HealthController {
  @Get("healthz")
  liveness(): { status: string; service: string; timestamp: string } {
    return {
      status: "ok",
      service: SERVICE_NAME,
      timestamp: new Date().toISOString(),
    };
  }

  @Get("readyz")
  readiness(): { status: string; service: string; timestamp: string } {
    return {
      status: "ok",
      service: SERVICE_NAME,
      timestamp: new Date().toISOString(),
    };
  }
}
