using Hotline.Orders;
using Microsoft.AspNetCore.Mvc;
using XF.Domain.Repository;

namespace Hotline.Api.Controllers;

public class SnapshotController : BaseController
{
    private readonly IRepository<Order> _orderRepository;

    public SnapshotController(IRepository<Order> orderRepository)
    {
        _orderRepository = orderRepository;
    }

    /// <summary>
    /// 获取随手拍电气焊动火作业待处理工单数量
    /// TODO 条件 电气焊作业申报
    /// </summary>
    /// <returns></returns>
    [HttpGet("wait_accept_count")]
    public async Task<int> GetSnapshotWaitForAcceptCountAsync()
        => await _orderRepository
            .CountAsync(m => m.SourceChannelCode == "ZGSSP" && m.Status == Share.Enums.Order.EOrderStatus.WaitForAccept);

}
