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

namespace Hotline.Settings.TimeLimitDomain;
public interface IExpireTimeHandler 
{
    Task<bool> NotWorkDay(DateTime date);

    /// <summary>
    /// 计算工作时间分钟数
    /// </summary>
    /// <param name="beginTime"></param>
    /// <param name="endTime"></param>
    /// <param name="workTime">工作日时间段</param>
    /// <param name="isCenter"></param>
    /// <returns>秒数</returns>
    Task<int> CalcWorkTimeAsync(DateTime beginTime, DateTime endTime, IList<string>? workTime, bool isCenter);

    /// <summary>
    /// 计算工作时间分钟数(已改返回秒)
    /// </summary>
    /// <param name="beginTime"></param>
    /// <param name="endTime"></param>
    /// <param name="workTime">工作日时间段</param>
    /// <param name="isCenter"></param>
    /// <returns></returns>
    Task<int> CalcWorkTimeExAsync(DateTime beginTime, DateTime endTime, IList<string>? workTime, bool isCenter);


    /// <summary>
    /// 计算工作日（新）
    /// </summary>
    /// <param name="beginTime"></param>
    /// <param name="startTime"></param>
    /// <param name="timeType"></param>
    /// <param name="workTime"></param>
    /// <param name="timeValue"></param>
    /// <param name="Percentage"></param>
    /// <param name="PercentageOne"></param>
    /// <returns></returns>
    Task<TimeResult> CalcEndTimeNewAsync(DateTime beginTime, DateTime startTime, ETimeType timeType, IList<string>? workTime, int timeValue, int Percentage, int PercentageOne, int? EndType);


    /// <summary>
    /// 计算工作日
    /// </summary>
    /// <param name="beginTime"></param>
    /// <param name="timeType"></param>
    /// <param name="timeValue"></param>
    /// <param name="workTime">工作日时间段</param>
    /// <param name="Percentage">即将超期百分比</param>
    /// <param name="PercentageOne">超期百分比第一级</param>
    /// <returns></returns>
    public Task<TimeResult> CalcEndTimeAsync(DateTime beginTime,DateTime startTime,IList<string>? workTime, TimeLimitSetting setting);

    Task<TimeResult> CalcEndTimeAsync(DateTime beginTime,DateTime startTime, TimeConfig timeConfig);

    /// <summary>
    /// 计算时间间隔
    /// </summary>
    /// <param name="beginTime"></param>
    /// <param name="endTime"></param>
    /// <param name="isCenter"></param>
    /// <returns></returns>
    string CalcTimeInterval(DateTime beginTime, DateTime endTime, bool isCenter);

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