using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using TakeoutSaaS.Shared.Abstractions.Results;
using TakeoutSaaS.Shared.Web.Api;

namespace TakeoutSaaS.AdminApi.Controllers;

/// <summary>
/// 管理后台 - 健康检查。
/// </summary>
[ApiVersion("1.0")]
[Route("api/admin/v{version:apiVersion}/[controller]")]
public class HealthController : BaseApiController
{
    /// <summary>
    /// 获取服务健康状态。
    /// </summary>
    /// <returns>健康状态</returns>
    [HttpGet]
    [AllowAnonymous]
    [ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status200OK)]
    public ApiResponse<object> Get()
    {
        // 1. 构造健康状态
        var payload = new { status = "OK", service = "AdminApi", time = DateTime.UtcNow };

        // 2. 返回健康响应
        return ApiResponse<object>.Ok(payload);
    }
}
