namespace Umbraco.Cms.Core.IO;
///
/// Provides methods allowing the manipulation of files.
///
public interface IFileSystem
{
///
/// Gets a value indicating whether the filesystem can add/copy
/// a file which is on a physical filesystem.
///
///
/// In other words, whether the filesystem can copy/move a file
/// that is on local disk, in a fast and efficient way.
///
bool CanAddPhysical { get; }
///
/// Gets all directories matching the given path.
///
/// The path to the directories.
///
/// The representing the matched directories.
///
IEnumerable GetDirectories(string path);
///
/// Deletes the specified directory.
///
/// The name of the directory to remove.
void DeleteDirectory(string path);
///
/// Deletes the specified directory and, if indicated, any subdirectories and files in the directory.
///
/// Azure blob storage has no real concept of directories so deletion is always recursive.
/// The name of the directory to remove.
/// Whether to remove directories, subdirectories, and files in path.
void DeleteDirectory(string path, bool recursive);
///
/// Determines whether the specified directory exists.
///
/// The directory to check.
///
/// True if the directory exists and the user has permission to view it; otherwise false.
///
bool DirectoryExists(string path);
///
/// Adds a file to the file system.
///
/// The path to the given file.
/// The containing the file contents.
void AddFile(string path, Stream stream);
///
/// Adds a file to the file system.
///
/// The path to the given file.
/// The containing the file contents.
/// Whether to override the file if it already exists.
void AddFile(string path, Stream stream, bool overrideIfExists);
///
/// Gets all files matching the given path.
///
/// The path to the files.
///
/// The representing the matched files.
///
IEnumerable GetFiles(string path);
///
/// Gets all files matching the given path and filter.
///
/// The path to the files.
/// A filter that allows the querying of file extension.
/// *.jpg
///
///
/// The representing the matched files.
///
IEnumerable GetFiles(string path, string filter);
///
/// Gets a representing the file at the given path.
///
/// The path to the file.
///
/// .
///
Stream OpenFile(string path);
///
/// Deletes the specified file.
///
/// The name of the file to remove.
void DeleteFile(string path);
///
/// Determines whether the specified file exists.
///
/// The file to check.
///
/// True if the file exists and the user has permission to view it; otherwise false.
///
bool FileExists(string path);
///
/// Returns the application relative path to the file.
///
/// The full path or URL.
///
/// The representing the relative path.
///
string GetRelativePath(string fullPathOrUrl);
///
/// Gets the full qualified path to the file.
///
/// The file to return the full path for.
///
/// The representing the full path.
///
string GetFullPath(string path);
///
/// Returns the application relative URL to the file.
///
/// The path to return the URL for.
///
/// representing the relative URL.
///
string GetUrl(string? path);
///
/// Gets the last modified date/time of the file, expressed as a UTC value.
///
/// The path to the file.
///
/// .
///
DateTimeOffset GetLastModified(string path);
///
/// Gets the created date/time of the file, expressed as a UTC value.
///
/// The path to the file.
///
/// .
///
DateTimeOffset GetCreated(string path);
///
/// Gets the size of a file.
///
/// The path to the file.
/// The size (in bytes) of the file.
long GetSize(string path);
///
/// Adds a file which is on a physical filesystem.
///
/// The path to the file.
/// The absolute physical path to the source file.
/// A value indicating what to do if the file already exists.
/// A value indicating whether to move (default) or copy.
void AddFile(string path, string physicalPath, bool overrideIfExists = true, bool copy = false);
// TODO: implement these
//
// void CreateDirectory(string path);
//
//// move or rename, directory or file
// void Move(string source, string target);
}