using System;
using System.Threading;
using System.Threading.Tasks;
using Dalamud.Game;
namespace Dalamud.Plugin.Services;
///
/// This class represents the Framework of the native game client and grants access to various subsystems.
///
public interface IFramework
{
///
/// A delegate type used with the event.
///
/// The Framework instance.
public delegate void OnUpdateDelegate(IFramework framework);
///
/// Event that gets fired every time the game framework updates.
///
public event OnUpdateDelegate Update;
///
/// Gets the last time that the Framework Update event was triggered.
///
public DateTime LastUpdate { get; }
///
/// Gets the last time in UTC that the Framework Update event was triggered.
///
public DateTime LastUpdateUTC { get; }
///
/// Gets the delta between the last Framework Update and the currently executing one.
///
public TimeSpan UpdateDelta { get; }
///
/// Gets a value indicating whether currently executing code is running in the game's framework update thread.
///
public bool IsInFrameworkUpdateThread { get; }
///
/// Gets a value indicating whether game Framework is unloading.
///
public bool IsFrameworkUnloading { get; }
///
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
///
/// Return type.
/// Function to call.
/// Task representing the pending or already completed function.
public Task RunOnFrameworkThread(Func func);
///
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
///
/// Function to call.
/// Task representing the pending or already completed function.
public Task RunOnFrameworkThread(Action action);
///
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
///
/// Return type.
/// Function to call.
/// Task representing the pending or already completed function.
public Task RunOnFrameworkThread(Func> func);
///
/// Run given function right away if this function has been called from game's Framework.Update thread, or otherwise run on next Framework.Update call.
///
/// Function to call.
/// Task representing the pending or already completed function.
public Task RunOnFrameworkThread(Func func);
///
/// Run given function in upcoming Framework.Tick call.
///
/// Return type.
/// Function to call.
/// Wait for given timespan before calling this function.
/// Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.
/// Cancellation token which will prevent the execution of this function if wait conditions are not met.
/// Task representing the pending function.
public Task RunOnTick(Func func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
///
/// Run given function in upcoming Framework.Tick call.
///
/// Function to call.
/// Wait for given timespan before calling this function.
/// Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.
/// Cancellation token which will prevent the execution of this function if wait conditions are not met.
/// Task representing the pending function.
public Task RunOnTick(Action action, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
///
/// Run given function in upcoming Framework.Tick call.
///
/// Return type.
/// Function to call.
/// Wait for given timespan before calling this function.
/// Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.
/// Cancellation token which will prevent the execution of this function if wait conditions are not met.
/// Task representing the pending function.
public Task RunOnTick(Func> func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
///
/// Run given function in upcoming Framework.Tick call.
///
/// Function to call.
/// Wait for given timespan before calling this function.
/// Count given number of Framework.Tick calls before calling this function. This takes precedence over delay parameter.
/// Cancellation token which will prevent the execution of this function if wait conditions are not met.
/// Task representing the pending function.
public Task RunOnTick(Func func, TimeSpan delay = default, int delayTicks = default, CancellationToken cancellationToken = default);
}