using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace PhoenixLib.Scheduler
{
///
/// This interface represents a cron scheduler.
/// A cron is a recurring job/task.
///
///
public interface IGenericCronPool
{
///
/// Creates a new cron.
///
/// Method to call when the cron is executed.
/// Time interval between each cron execution.
///
void New(TId cronId, Expression method, Interval interval);
///
/// Creates a new cron.
///
/// Method to call when the cron is executed.
/// Time interval between each cron execution.
///
void New(TId cronId, Expression> method, Interval interval);
///
/// Creates a new cron.
///
/// Method to call when the cron is executed.
/// Time interval between each cron execution.
///
void New(TId cronId, Expression> method, Interval interval);
///
/// Creates a new cron.
///
/// Method to call when the cron is executed.
/// Time interval between each cron execution.
///
void New(TId cronId, Expression>> method, Interval interval);
///
/// Removes by id an existing cron.
/// May throw if the given cron id does not correspond to a valid cron.
///
/// Id of the cron to remove.
void Remove(TId cronId);
///
/// Behaves similarly as 'Remove' but with a strictly defined
/// behavior and a performance penalty is the price to pay:
/// it checks if the given cron id is valid before trying to remove
/// the corresponding cron.
///
///
void RemoveIfExists(TId cronId);
}
}