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

namespace GxPress.Api.AppControllers
{
    /// <summary>
    /// APP财务数据
    /// </summary>
    [Route("api/app/finance")]
    [ApiController]
    public class FinanceController : ControllerBase
    {
        private readonly ILogger<FinanceController> _logger;
        private readonly IFinanceRepository _repository;

        public FinanceController(ILogger<FinanceController> logger, IFinanceRepository repository)
        {
            _logger = logger;
            _repository = repository;
        }
        /// <summary>
        /// 财务图表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("chart")]
        public async Task<FinanceResult> GetFinanceChart(FinanceRequest request)
        {
            return await _repository.GetFinanceChartAsync(request);
        }
    }
}