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

namespace GxPress.Api.AppControllers
{
    /// <summary>
    /// APP仓库数据
    /// </summary>
    [Route("api/app/storehouse")]
    [ApiController]
    [Authorize]
    public class StorehouseController : ControllerBase
    {
        private readonly ILogger<StorehouseController> _logger;
        private readonly IStorehouseRepository _repository;

        public StorehouseController(ILogger<StorehouseController> logger, IStorehouseRepository repository)
        {
            _logger = logger;
            _repository = repository;
        }
        /// <summary>
        /// 库存图标
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("chart")]
        [AllowAnonymous]
        public async Task<StorehouseResult> GetStorehouseChart(StorehouseRequest request)
        {
            return await _repository.GetStorehouseChartAsync(request);
        }
    }
}