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

namespace GxPress.Api.AppControllers
{
    /// <summary>
    /// App出版数据
    /// </summary>
    [Route("api/app/print")]
    [ApiController]
    [Authorize]
    public class PrintController : ControllerBase
    {
        private readonly ILogger<AppControllers.PrintController> _logger;
        private readonly IPrintRepository _repository;

        public PrintController(ILogger<AppControllers.PrintController> logger, IPrintRepository repository)
        {
            _logger = logger;
            _repository = repository;
        }
        /// <summary>
        /// 出版数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("chart")]
        [AllowAnonymous]
        public async Task<PrintResult> GetSellChart(PrintRequest request)
        {
            return await _repository.GetPrintChartAsync(request);
        }
    }
}