using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
namespace EmbedIO.Files
{
///
/// Represents an object that can provide files and/or directories to be served by a .
///
public interface IFileProvider
{
///
/// Occurs when a file or directory provided by this instance is modified or removed.
/// The event's parameter is the provider-specific path of the resource that changed.
///
event Action ResourceChanged;
///
/// Gets a value indicating whether the files and directories provided by this instance
/// will never change.
///
bool IsImmutable { get; }
///
/// Signals a file provider that the web server is starting.
///
/// A used to stop the web server.
void Start(CancellationToken cancellationToken);
///
/// Maps a URL path to a provider-specific path.
///
/// The URL path.
/// An interface to use
/// for determining the MIME type of a file.
/// A provider-specific path identifying a file or directory,
/// or if this instance cannot provide a resource associated
/// to .
MappedResourceInfo? MapUrlPath(string urlPath, IMimeTypeProvider mimeTypeProvider);
///
/// Opens a file for reading.
///
/// The provider-specific path for the file.
///
/// A readable of the file's contents.
///
Stream OpenFile(string path);
///
/// Returns an enumeration of the entries of a directory.
///
/// The provider-specific path for the directory.
/// An interface to use
/// for determining the MIME type of files.
/// An enumeration of objects identifying the entries
/// in the directory identified by .
IEnumerable GetDirectoryEntries(string path, IMimeTypeProvider mimeTypeProvider);
}
}