using System.Threading.Tasks;
using GxPress.Repository.Interface;
using GxPress.Request.Sell;
using GxPress.Result.sell;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace GxPress.Api.AppControllers
{
    /// <summary>
    /// APP发行数据
    /// </summary>
    [Route("api/app/sell")]
    [ApiController]
    [Authorize]
    public class SellController : ControllerBase
    {
        private readonly ILogger<AppControllers.SellController> _logger;
        private readonly ISellRepository _repository;

        public SellController(ILogger<AppControllers.SellController> logger, ISellRepository repository)
        {
            _logger = logger;
            _repository = repository;
        }
        /// <summary>
        /// 发行图表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("chart")]
        [AllowAnonymous]
        public async Task<SellResult> GetSellChart(SellRequest request)
        {
            return await _repository.GetSellChartAsync(request);
        }
    }
}