using Hotline.Share.Dtos.Settings;
using Hotline.Share.Enums.FlowEngine;
using Hotline.Share.Enums.Settings;
using XF.Domain.Dependency;

namespace Hotline.Settings.TimeLimitDomain;
public interface ICalcExpireTime
{
    public Task<TimeResult?> CalcEndTime(DateTime beginTime,DateTime startTime, ETimeType timeType, int timeValue, string busCode);

    public Task<ExpiredTimeWithConfig?> CalcEndTime(DateTime beginTime,DateTime startTime, string busCode);

    public Task<ExpiredTimeWithConfig> CalcEndTime(DateTime beginTime,DateTime startTime, TimeConfig timeConfig, string? busCode);

    public Task<TimeResult?> CalcEndTime(EFlowDirection flowDirection, int Percentage, int PercentageOne, ETimeType? timeType = null, int? timeValue = null);

    public Task<decimal> CalcWorkTimeToDecimal(DateTime beginTime, DateTime endTime, bool isCenter);

    public Task<decimal> CalcWorkTimeToHour(DateTime beginTime, DateTime endTime, bool isCenter);

    /// <summary>
    /// 计算工作时间分钟数（已改返回秒）
    /// </summary>
    /// <param name="beginTime"></param>
    /// <param name="endTime"></param>
    /// <returns></returns>
    Task<int> CalcWorkTime(DateTime beginTime, DateTime endTime, bool isCenter);
    Task<int> CalcWorkTimeEx(DateTime beginTime, DateTime endTime, bool isCenter);
    Task<DateTime> WorkDay(DateTime now);
    Task<DateTime> GetWorkDay(DateTime now);

	Task<TimeResult> CalcEndTime(DateTime beginTime,DateTime startTime, ETimeType timeType, int timeValue, int Percentage, int PercentageOne);

    /// <summary>
    /// 倒推工作日
    /// </summary>
    /// <param name="date"></param>
    /// <returns></returns>
    Task<DateTime?> CalcWorkTimeReduce(DateTime now, int timeValue);

    TimeConfig GetOrderTimeLimitConfig(string? code = null);

    /// <summary>
    /// 计算工单期满时间
    /// </summary>
    /// <param name="now"></param>
    /// <param name="centerToOrg"></param>
    /// <param name="orderTimeClacInfo"></param>
    /// <returns></returns>
    //Task<ExpiredTimeWithConfig> CalcExpiredTime(DateTime now, EFlowDirection centerToOrg, OrderTimeClacInfo orderTimeClacInfo);

    /// <summary>
    /// 计算工单期满时间（新）
    /// </summary>
    /// <param name="beginTime"></param>
    /// <param name="startTime"></param>
    /// <param name="flowDirection"></param>
    /// <param name="order"></param>
    /// <returns></returns>
    Task<ExpiredTimeWithConfig> CalcExpiredTime(DateTime beginTime, DateTime startTime, EFlowDirection flowDirection, OrderTimeClacInfo order);
}
