using CloudGaming.Api.Base;
using CloudGaming.Code.Epg;
using CloudGaming.Code.Game;
using CloudGaming.Code.MiddlewareExtend;
using CloudGaming.DtoModel.Epg;
using CloudGaming.DtoModel.Game;

using Microsoft.AspNetCore.JsonPatch.Internal;
using Microsoft.AspNetCore.Mvc;

namespace CloudGaming.Api.Controllers;

/// <summary>
/// 首页
/// </summary>
public class HomeController : CloudGamingControllerBase
{
    public HomeController(IServiceProvider _serviceProvider) : base(_serviceProvider)
    {
    }

    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    //[RedisCache(1, 0, 0)]
    public async Task<List<EpgCategoryDto>> GetHomeInfo()
    {
        EpgBLL epgBLL = new EpgBLL(ServiceProvider);
        return await epgBLL.GetHomeInfo();
    }

    /// <summary>
    /// 首页排行榜
    /// </summary>
    /// <returns></returns>
    [HttpGet]
    [RedisCache(10, 0)]
    public async Task<List<GameHistoryListDto>> GetGameRankingList()
    {
        GameBLL gamebll = new GameBLL(this.ServiceProvider);
        return await gamebll.GetGameRankingList();
    }
}
