// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace System.Reactive.Concurrency
{
    /// 
    /// Represents an object that schedules units of work.
    /// 
    public interface IScheduler
    {
        /// 
        /// Gets the scheduler's notion of current time.
        /// 
        DateTimeOffset Now { get; }
        /// 
        /// Schedules an action to be executed.
        /// 
        /// The type of the state passed to the scheduled action.
        /// State passed to the action to be executed.
        /// Action to be executed.
        /// The disposable object used to cancel the scheduled action (best effort).
        IDisposable Schedule(TState state, Func action);
        /// 
        /// Schedules an action to be executed after dueTime.
        /// 
        /// The type of the state passed to the scheduled action.
        /// State passed to the action to be executed.
        /// Action to be executed.
        /// Relative time after which to execute the action.
        /// The disposable object used to cancel the scheduled action (best effort).
        IDisposable Schedule(TState state, TimeSpan dueTime, Func action);
        /// 
        /// Schedules an action to be executed at dueTime.
        /// 
        /// The type of the state passed to the scheduled action.
        /// State passed to the action to be executed.
        /// Action to be executed.
        /// Absolute time at which to execute the action.
        /// The disposable object used to cancel the scheduled action (best effort).
        IDisposable Schedule(TState state, DateTimeOffset dueTime, Func action);
    }
}