using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hotline.FlowEngine.Workflows;
using Hotline.Orders;
using Hotline.Share.Dtos;
using Hotline.Share.Dtos.DataSharing.PusherHotlineDto;
using Hotline.Share.Dtos.FlowEngine.Workflow;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Enums.Order;
using Hotline.Share.Enums.Settings;
using Hotline.Share.Requests;
using SqlSugar;
using XF.Domain.Authentications;
using XF.Domain.Entities;

namespace Hotline.Application.Orders
{
    public interface IOrderApplication
    {
        /// <summary>
        /// 更新工单办理期满时间
        /// 1.更新工单 2.更新流程
        /// </summary>
        /// <returns></returns>
        Task DelayOrderExpiredTimeAsync(string orderId, int timeCount, ETimeType timeType, CancellationToken cancellationToken);

        /// <summary>
        /// 新增工单办理流程记录
        /// </summary>
        Task AddOrderTracesAsync(string orderId, ICollection<WorkflowTraceDto> traces, CancellationToken cancellationToken);

        /// <summary>
        /// 撤销工单
        /// </summary>
        Task CancelOrderAsync(string orderId, string opinion, CancellationToken cancellationToken);

        ISugarQueryable<Order> GetToExpireAsync(AboutToExpireListDto dto);
		//Task<PagedDto<WorkflowOrderDto>> GetToExpireNodeAsync(AboutToExpireListDto dto, CancellationToken cancellationToken);
		ISugarQueryable<Order> GetAboutToExpireAsync(AboutToExpireListDto dto);
        //Task<PagedDto<WorkflowOrderDto>> GetAboutToExpireNodeAsync(AboutToExpireListDto dto, CancellationToken cancellationToken);
        Task OrderParticiple(string inputStr, string orderId, CancellationToken cancellationToken);
        Task OrderSensitiveParticiple(string inputStr, string orderId, CancellationToken cancellationToken);
        /// <summary>
        /// 接收外部平台工单
        /// </summary>
        Task<AddOrderResponse> ReceiveOrderFromExternalAsync(AddOrderDto dto, ISessionContext current, CancellationToken cancellationToken);

        /// <summary>
        /// 接收外部平台修改工单附件
        /// </summary>
        Task UpdateOrderFilesAnonymousAsync(UpdateOrderFilesDto dto, CancellationToken cancellationToken);

        /// <summary>
        /// 工单回访
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task OrderVisitWeb(OrderVisitWebDto dto, CancellationToken cancellationToken);

        #region 工单办理

        ISugarQueryable<Order> QueryOrders(QueryOrderDto dto);

        #endregion

        /// <summary>
        /// 未签收统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ISugarQueryable<Order, WorkflowStep> QueryUnsignedOrders(QueryUnsignedOrdersRequest dto);

        /// <summary>
        /// 信件来源统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ISugarQueryable<Order> QueryOrderSource(QueryOrderSourceRequest dto);

		/// <summary>
		/// 信件来源统计列表
        /// </summary>
		/// <param name="dto"></param>
		/// <returns></returns>
		Task<List<OrderSourceHeaderVo>> QueryOrderSourceList(QueryOrderSourceRequest dto);

        /// <summary>
        /// 信件来源统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ISugarQueryable<Order> QueryOrderSourceDetail(QueryOrderSourceDetailRequest dto);
	}
}