using System.Threading.Tasks;
using GxPress.Common.Page;
using GxPress.Repository.Interface.Order;
using GxPress.Request.Order;
using GxPress.Result.Order;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace GxPress.Api.AdminControllers
{
    /// <summary>
    /// 商务管理
    /// </summary>
    [Route("api/admin/admin")]
    [ApiController]
    [Authorize]
    public class AdminOrderController : Controller
    {
        private readonly IOrderRepository orderRepository;
        public AdminOrderController(IOrderRepository orderRepository)
        {
            this.orderRepository = orderRepository;
        }
        /// <summary>
        /// 订单管理 查询订单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost("list")]
        public async Task<PagedList<Entity.Order.Order>> GetAllOrderAsync(OrderSearchRequest request)
        {
            return await orderRepository.GetAllOrderAsync(request);
        }
        /// <summary>
        /// 财务中心
        /// </summary>
        /// <param name="request"></param>
        /// /// <returns></returns>
        [HttpPost("finance-list")]
        public async Task<OrderFinanceResult<Entity.Order.Order>> GetAllOrderFinnceAsync(OrderFinanceSearchRequest request)
        {
            return await orderRepository.GetAllOrderFinnceAsync(request);
        }
    }
}