using CloudGaming.AppConfigModel;
using CloudGaming.Code.Monitor;
using CloudGaming.DtoModel.Other;
using CloudGaming.ExtApi.Base;

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace CloudGaming.ExtApi.Controllers;


/// <summary>
/// 监控数据
/// </summary>
public class MonitorController : CloudGamingControllerBase
{
    public MonitorController(IServiceProvider _serviceProvider) : base(_serviceProvider)
    {
    }
    /// <summary>
    /// 获取监控数据
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    public AppBasicStatistics GetAppMonitorInfo()
    {
        return new MonitorBLL(ServiceProvider).GetAppMonitorInfo();
    }
    /// <summary>
    /// 获取用户登录数据
    /// </summary>
    /// <param name="startTimeStamp"></param>
    /// <param name="endTimeStamp"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<dynamic> GetActiveUserCount([FromQuery] long startTimeStamp = 0, [FromQuery] long endTimeStamp = 0)
    {
        return await new MonitorBLL(ServiceProvider).GetActiveUserCount(startTimeStamp, endTimeStamp);
    }
    /// <summary>
    /// 获取每小时统计
    /// </summary>
    /// <param name="startTimeStamp"></param>
    /// <param name="endTimeStamp"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<dynamic> GetAppMonitorHourAsync([FromQuery] long startTimeStamp = 0, [FromQuery] long endTimeStamp = 0)
    {
        return await new MonitorBLL(ServiceProvider).GetAppMonitorHourAsync(startTimeStamp, endTimeStamp);
    }

    
}
