using CloudGaming.Api.Base;
using CloudGaming.Code.DataAccess;
using CloudGaming.Code.Other;
using CloudGaming.DtoModel.RedemptionCode;
using CloudGaming.DtoModel.SevenSign;

using HuanMeng.DotNetCore.Base;

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

namespace CloudGaming.Api.Controllers;


/// <summary>
/// 兑换码
/// </summary>
public class RedemptionController : CloudGamingControllerBase
{
    public RedemptionController(IServiceProvider _serviceProvider) : base(_serviceProvider)
    {
    }
    /// <summary>
    /// 使用兑换码
    /// </summary>
    /// <param name="redemptionCode"></param>
    /// <returns></returns>
    [HttpPost]
    [Authorize]
    public async Task<BaseResponse<bool>> UseRedemptionCode([FromBody] RedemptionCodeRequest redemptionCode)
    {
        RedemptionBLL redemptionBLL = new RedemptionBLL(ServiceProvider);
        return await redemptionBLL.UseRedemptionCodeAsync(redemptionCode.Code);
    }

}