namespace WalletService.API.Controllers;

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;

/// <summary>
/// EN: Controller for health checks
/// VI: Controller cho health checks
/// </summary>
[ApiController]
[Route("api/v1/[controller]")]
[AllowAnonymous]
[SwaggerTag("Health check endpoints / Các endpoint kiểm tra sức khỏe")]
public class HealthController : ControllerBase
{
    /// <summary>
    /// EN: Liveness probe
    /// VI: Kiểm tra service còn sống
    /// </summary>
    [HttpGet("live")]
    [SwaggerOperation(Summary = "Liveness check", Description = "Check if the service is running")]
    [SwaggerResponse(200, "Service is alive")]
    public IActionResult Live()
    {
        return Ok(new { status = "alive", timestamp = DateTime.UtcNow });
    }

    /// <summary>
    /// EN: Readiness probe
    /// VI: Kiểm tra service sẵn sàng
    /// </summary>
    [HttpGet("ready")]
    [SwaggerOperation(Summary = "Readiness check", Description = "Check if the service is ready to accept traffic")]
    [SwaggerResponse(200, "Service is ready")]
    [SwaggerResponse(503, "Service is not ready")]
    public IActionResult Ready()
    {
        // EN: Add additional health checks here (database, redis, etc.)
        // VI: Thêm các health checks khác ở đây (database, redis, v.v.)
        return Ok(new { status = "ready", timestamp = DateTime.UtcNow });
    }
}
