using Hotline.Settings;
using Hotline.Share.Requests;
using SqlSugar;
using System.Data;
using XF.Domain.Repository;

namespace Hotline.Orders
{
    public interface IOrderRepository : IRepositoryWorkflow<Order>
    {
        Task<string> AddOrderNavAsync(Order order, CancellationToken cancellationToken);
        Task RemoveOrderWrodBatchAsync(List<string> ids, CancellationToken cancellationToken);
        Task RemoveOrderObserveBatchAsync(List<string> ids, CancellationToken cancellationToken);
        Task RemoveOrderFinalityBatchAsync(List<string> ids, CancellationToken cancellationToken);
        Task OrderScreenRevisionVisit(string VisitId, bool canHandle, CancellationToken cancellationToken);
        Task FileAsync(Order order, CancellationToken cancellationToken);

        Task<object> HotPortJoinOrgStatistics(DateTime StartTime, DateTime EndTime, bool IsCenter, string? OrgCode);

        ISugarQueryable<DepartmentalProcessingStatisticsDataDto> OrderUnionAll(ISugarQueryable<DepartmentalProcessingStatisticsDataDto> t1,
         ISugarQueryable<DepartmentalProcessingStatisticsDataDto> t2,
         ISugarQueryable<DepartmentalProcessingStatisticsDataDto> t3,
         ISugarQueryable<DepartmentalProcessingStatisticsDataDto> t4,
         ISugarQueryable<DepartmentalProcessingStatisticsDataDto> t5,
         ISugarQueryable<DepartmentalProcessingStatisticsDataDto> t6);

        ISugarQueryable<SelectOrderId> OrderListUnionAll(ISugarQueryable<SelectOrderId> t1, ISugarQueryable<SelectOrderId> t2);

        /// <summary>
        /// 区域分时统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<object> OrderAreaTime(TimeSharingPagedKeywordRequest dto);

        /// <summary>
        /// 区域分时统计--导出
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<DataTable> OrderAreaTimeExport(TimeSharingPagedKeywordRequest dto);

        /// <summary>
        /// 热点类型分时统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<object> OrderHotspotTime(TimeSharingPagedKeywordRequest dto);

        /// <summary>
        /// 热点类型分时统计---导出
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<DataTable> OrderHotspotTimeExport(TimeSharingPagedKeywordRequest dto);

        /// <summary>
        /// 受理类型分时统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<object> OrderAcceptanceTime(TimeSharingPagedKeywordRequest dto);

        /// <summary>
        /// 受理类型分时统计---导出
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<DataTable> OrderAcceptanceTimeExport(TimeSharingPagedKeywordRequest dto);

        /// <summary>
        /// 信件来源分时统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<object> OrderSourceTime(TimeSharingPagedKeywordRequest dto);

        /// <summary>
        /// 信件来源分时统计---导出
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<DataTable> OrderSourceTimeExport(TimeSharingPagedKeywordRequest dto);


        /// <summary>
        /// 信件来源统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<object> OrderSource(QueryOrderSourceRequest dto);

        /// <summary>
        /// 信件来源统计 -- 导出
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
		Task<DataTable> OrderSourceExport(QueryOrderSourceRequest dto);

        ISugarQueryable<T> UnionAll<T>(params ISugarQueryable<T>[] queryables) where T : class;

        /// <summary>
        /// 部门办件统计
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        List<DepartmentalProcessingStatisticsDataDto> DepartmentalProcessingStatisticsNew(string sql);


        /// <summary>
        ///  热点区域明细
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ISugarQueryable<HotspotAndAreaStatisticsDetailDto> HotspotAndAreaStatisticsDetail(HotspotAndAreaStatisticsDetailReq dto);

        /// <summary>
        /// 根据时间查询受理类型统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<(List<SystemDicData> acceptType, object items)> AcceptTypeStatisticsByDate(AcceptTypeStatisticsByDateReq dto);

        /// <summary>
        /// 根据时间查询受理类型统计-导出
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<DataTable> AcceptTypeStatisticsByDateExport(AcceptTypeStatisticsByDateReq dto);

        /// <summary>
        /// 受理类型导出表处理
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="AddColumnName"></param>
        /// <returns></returns>
        DataTable InitAcceptTypeTable(DataTable dt, List<string> AddColumnName);

        /// <summary>
        /// 受理类型明细
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ISugarQueryable<HotspotAndAreaStatisticsDetailDto> AcceptTypeStatisticsByDateDetail(AcceptTypeStatisticsByDateDetailReq dto);
    }

    public interface IOrderScreenRepository : IRepositoryWorkflow<OrderScreen>
    {

    }

    public interface IOrderDelayRepository : IRepositoryWorkflow<OrderDelay>
    {

    }
}
