// Copyright © WireMock.Net
namespace WireMock.Handlers;
///
/// Handler to interact with the file system to handle folders and read and write (static mapping) files.
///
public interface IFileSystemHandler
{
///
/// Gets the folder where the static mappings are located. For local file system, this would be `{CurrentFolder}/__admin/mappings`.
///
/// The folder name.
string GetMappingFolder();
///
/// Determines whether the given path refers to an existing directory on disk.
///
/// The path.
/// true if path refers to an existing directory; false if the directory does not exist or an error occurs when trying to determine if the specified directory exists.
bool FolderExists(string path);
///
/// Creates all directories and subdirectories in the specified path unless they already exist.
///
/// The path.
void CreateFolder(string path);
///
/// Returns an enumerable collection of file names in a specified path.
///
/// The path.
/// A value indicating whether subdirectories should also be included when enumerating files.
/// An enumerable collection of the full names (including paths) for the files in the directory (and optionally subdirectories) specified by path.
IEnumerable EnumerateFiles(string path, bool includeSubdirectories);
///
/// Read a static mapping file as text.
///
/// The path (folder + filename with .json extension).
/// The file content as text.
string ReadMappingFile(string path);
///
/// Write the static mapping file.
///
/// The path (folder + filename with .json extension).
/// The text.
void WriteMappingFile(string path, string text);
///
/// Read a response body file as byte[].
///
/// The path or filename from the file to read.
/// The file content as bytes.
byte[] ReadResponseBodyAsFile(string path);
///
/// Read a response body file as text.
///
/// The path or filename from the file to read.
/// The file content as text.
string ReadResponseBodyAsString(string path);
///
/// Delete a file.
///
/// The filename.
void DeleteFile(string filename);
///
/// Determines whether the given path refers to an existing file on disk.
///
/// The filename.
/// true if path refers to an existing file; false if the file does not exist.
bool FileExists(string filename);
///
/// Write a file.
///
/// The filename.
/// The bytes.
void WriteFile(string filename, byte[] bytes);
///
/// Write a file.
///
/// The folder.
/// The filename.
/// The bytes.
void WriteFile(string folder, string filename, byte[] bytes);
///
/// Read a file as bytes.
///
/// The filename.
/// The file content as bytes.
byte[] ReadFile(string filename);
///
/// Read a file as string.
///
/// The filename.
/// The file content as a string.
string ReadFileAsString(string filename);
///
/// Gets the folder where the unmatched requests should be stored. For local file system, this would be `{CurrentFolder}/requests/unmatched`.
///
/// The folder name.
string GetUnmatchedRequestsFolder();
///
/// Write an unmatched request to the Unmatched RequestsFolder.
///
/// The filename.
/// The text.
void WriteUnmatchedRequest(string filename, string text);
}