using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Renci.SshNet.Common;
namespace Renci.SshNet
{
    /// 
    /// Base interface for SSH subsystem implementations.
    /// 
    internal interface ISubsystemSession : IDisposable
    {
        /// 
        /// Gets the logger factory for this subsystem session.
        /// 
        /// 
        /// The logger factory for this connection. Will never return .
        /// 
        public ILoggerFactory SessionLoggerFactory { get; }
        /// 
        /// Gets or sets the number of milliseconds to wait for an operation to complete.
        /// 
        /// 
        /// The number of milliseconds to wait for an operation to complete, or -1 to wait indefinitely.
        /// 
        int OperationTimeout { get; set; }
        /// 
        /// Gets a value indicating whether this session is open.
        /// 
        /// 
        ///  if this session is open; otherwise, .
        /// 
        bool IsOpen { get; }
        /// 
        /// Connects the subsystem using a new SSH channel session.
        /// 
        /// The session is already connected.
        /// The method was called after the session was disposed.
        void Connect();
        /// 
        /// Disconnects the subsystem channel.
        /// 
        void Disconnect();
        /// 
        /// Waits a specified time for a given  to be signaled.
        /// 
        /// The handle to wait for.
        /// The number of milliseconds to wait for  to be signaled, or -1 to wait indefinitely.
        /// The connection was closed by the server.
        /// The channel was closed.
        /// The handle did not get signaled within the specified timeout.
        void WaitOnHandle(WaitHandle waitHandle, int millisecondsTimeout);
        /// 
        /// Asynchronously waits for a given  to be signaled.
        /// 
        /// The handle to wait for.
        /// The number of milliseconds to wait for  to be signaled, or -1 to wait indefinitely.
        /// The cancellation token to observe.
        /// The connection was closed by the server.
        /// The channel was closed.
        /// The handle did not get signaled within the specified timeout.
        /// A  representing the wait.
        Task WaitOnHandleAsync(WaitHandle waitHandle, int millisecondsTimeout, CancellationToken cancellationToken);
        /// 
        /// Asynchronously waits for a given  to complete.
        /// 
        /// The type of the result which is being awaited.
        /// The handle to wait for.
        /// The number of milliseconds to wait for  to complete, or -1 to wait indefinitely.
        /// The cancellation token to observe.
        /// The connection was closed by the server.
        /// The channel was closed.
        /// The handle did not get signaled within the specified timeout.
        /// A  representing the wait.
        Task WaitOnHandleAsync(TaskCompletionSource tcs, int millisecondsTimeout, CancellationToken cancellationToken);
        /// 
        /// Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed
        /// integer to specify the time interval.
        /// 
        /// A  array - constructed using  - containing the objects to wait for.
        /// To number of milliseconds to wait for a  to get signaled, or -1 to wait indefinitely.
        /// 
        /// The array index of the first non-system object that satisfied the wait.
        /// 
        /// The connection was closed by the server.
        /// The channel was closed.
        /// No object satisfied the wait and a time interval equivalent to  has passed.
        /// 
        /// For the return value, the index of the first non-system object is considered to be zero.
        /// 
        int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout);
        /// 
        /// Creates a  array that is composed of system objects and the specified
        /// elements.
        /// 
        /// The first  to wait for.
        /// The second  to wait for.
        /// 
        /// A  array that is composed of system objects and the specified elements.
        /// 
        WaitHandle[] CreateWaitHandleArray(WaitHandle waitHandle1, WaitHandle waitHandle2);
    }
}