
//============================================================================================================
// Microsoft Updater Application Block for .NET
//  http://msdn.microsoft.com/library/en-us/dnbda/html/updater.asp
//	
// IDownloader.cs
//
// Interface to define downloader contract.
// 
// For more information see the Updater Application Block Implementation Overview. 
// 
//============================================================================================================
// Copyright (C) 2000-2001 Microsoft Corporation
// All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
//============================================================================================================


using System;
using System.Collections;
using System.Xml;

namespace Microsoft.ApplicationBlocks.ApplicationUpdater.Interfaces
{
	/// <summary>
	/// The status of a multiple file Job
	/// </summary>
	public enum JobStatus
	{ 
		/// <summary>
		/// The download job has finished
		/// </summary>
		Ready, 

		/// <summary>
		/// The server is still downloading the files
		/// </summary>
		Downloading, 
	
		/// <summary>
		/// There has been an error
		/// </summary>
		Error, 

		/// <summary>
		/// The job was cancelled
		/// </summary>
		Cancelled, 

		/// <summary>
		/// Once Validator starts working on a Job, it sets this to Validating to effectively "dequeue"
		/// </summary>
		Validating
	}


	/// <summary>
	/// The interface used to abstract the downloaded.
	/// </summary>
	public interface IDownloader : IDisposable //mstuart--added idisposable, class may work with hard assets like sockets or other 
	{
		/// <summary>
		/// Initialization for the downloader
		/// </summary>
		/// <param name="config">Xml node with the configuration for the Downloader</param>
		void Init( XmlNode config );

		/// <summary>
		/// Download synchronously a single file, the method does not return until download is finished
		/// </summary>
		/// <param name="sourceFile">Source file on the HTTP server to download</param>
		/// <param name="destFile">The local file path</param>
		/// <param name="maxTimeWait">The maximum time to wait for file download.</param>
		void Download( string sourceFile, string destFile, TimeSpan maxTimeWait );

		/// <summary>
		/// Asynchronous download of a group of files.
		/// </summary>
		Guid BeginDownload( string[] sourceFile, string[] destFile );

		/// <summary>
		/// Returns the status for an asynchronous download job.
		/// </summary>
		JobStatus GetJobStatus( Guid jobId );
//

	}
}
