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

namespace GxPress.Api.AppControllers
{
    /// <summary>
    /// App人事数据
    /// </summary>
    [Route("api/app/human-affairs")]
    [ApiController]
    [Authorize]
    public class HumanAffairsController : ControllerBase
    {
        private readonly ILogger<AppControllers.HumanAffairsController> _logger;
        private readonly IHumanAffairsRepository _repository;

        public HumanAffairsController(ILogger<AppControllers.HumanAffairsController> logger, IHumanAffairsRepository repository)
        {
            _logger = logger;
            _repository = repository;
        }
        /// <summary>
        /// App人事图表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("chart")]
        [AllowAnonymous]
        public async Task<HumanAffairsResult> GetHumanAffairsChart(HumanAffairsRequest request)
        {
            return await _repository.GetHumanAffairsChartAsync(request);
        }
    }
}