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

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

        IPackageBusiness packageBusiness;

        public PackageController(IPackageBusiness packageBusiness)
        {
            this.packageBusiness = packageBusiness;
        }

        /// <summary>
        /// Load coin packages for purchase
        /// POST /apis/package/load
        /// </summary>
        [HttpPost]
        [Route(ApiUrlConstant.PackageLoadUrl)]
        public async Task<IActionResult> PackageLoad([FromBody] PackageLoadReq request)
        {
            return await packageBusiness.PackageLoad(HttpContext.Request, request);
        }

        /// <summary>
        /// Load exchange/withdraw configurations
        /// POST /apis/package/exchange
        /// </summary>
        [HttpPost]
        [Route(ApiUrlConstant.ExchangeConfigLoadUrl)]
        public async Task<IActionResult> ExchangeConfigLoad([FromBody] ExchangeConfigLoadReq request)
        {
            return await packageBusiness.ExchangeConfigLoad(HttpContext.Request, request);
        }
    }
}
