namespace Milimoe.FunGame.Core.Model
{
public class RecurringTask(string name, TimeSpan interval, Action action)
{
///
/// 任务名称
///
public string Name { get; set; } = name;
///
/// 循环执行间隔
///
public TimeSpan Interval { get; set; } = interval;
///
/// 任务执行逻辑
///
public Action Action { get; set; } = action;
///
/// 记录上一次运行时间
///
public DateTime? LastRun { get; set; } = null;
///
/// 记录下一次运行时间
///
public DateTime NextRun { get; set; } = DateTime.MaxValue;
///
/// 最后一次运行时发生的错误
///
public Exception? Error { get; set; }
}
}