using Common.Constant;
using Microsoft.AspNetCore.Mvc;
using SicboSub.Api.Business;
using SicboSub.Api.DTO;

namespace SicboSub.Api.Controllers
{
    [ApiController]
    public class GameController : Controller
    {
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(GameController));

        IGameBusiness gameBusiness;

        public GameController(IGameBusiness gameBusiness)
        {
            this.gameBusiness = gameBusiness;
        }

        /// <summary>
        /// Get play history (betting + winning)
        /// POST /apis/game/play_history
        /// </summary>
        [HttpPost]
        [Route(ApiUrlConstant.PlayHistoryUrl)]
        public async Task<IActionResult> PlayHistory([FromBody] PlayHistoryReq request)
        {
            return await gameBusiness.PlayHistory(HttpContext.Request, request);
        }

        /// <summary>
        /// Get ranking prize history (daily/monthly)
        /// POST /apis/game/ranking_history
        /// </summary>
        [HttpPost]
        [Route(ApiUrlConstant.RankingHistoryUrl)]
        public async Task<IActionResult> RankingHistory([FromBody] RankingHistoryReq request)
        {
            return await gameBusiness.RankingHistory(HttpContext.Request, request);
        }
        [HttpPost]
        [Route(ApiUrlConstant.PurchaseHistoryUrl)]
        public async Task<IActionResult> PurchaseHistory([FromBody] PurchaseHistoryReq request)
        {
            return await gameBusiness.PurchaseHistory(HttpContext.Request, request);
        }

        /// <summary>
        /// Get ranking coin standing (daily/monthly standings without reward log)
        /// POST /apis/game/ranking_coin_history
        /// </summary>
        [HttpPost]
        [Route(ApiUrlConstant.RankingCointHistoryUrl)]
        public async Task<IActionResult> RankingCoinHistory([FromBody] RankingHistoryReq request)
        {
             return await gameBusiness.RankingCoinHistory(HttpContext.Request, request);
        }
    }
}
