using Penumbra.Api.Enums;
namespace Penumbra.Api.Api;
/// API methods pertaining to management of mods.
public interface IPenumbraApiMods
{
/// A list of all installed mods. The first string is their directory name, the second string is their mod name.
public Dictionary GetModList();
/// Try to unpack and install a valid mod file (.pmp, .ttmp, .ttmp2) as if installed manually.
/// The file that should be unpacked.
/// Success, MissingFile. Success does not indicate successful installing, just successful queueing for install.
public PenumbraApiEc InstallMod(string modFilePackagePath);
/// Try to reload an existing mod given by its name or .
/// Reload is the same as if triggered by button press and might delete the mod if it is not valid anymore.
/// ModMissing if the mod can not be found or Success
public PenumbraApiEc ReloadMod(string modDirectory, string modName);
/// Try to add a new mod inside the mod root directory.
/// Note that success does only imply a successful call, not a successful mod load.
/// The name (not full name) of the mod directory.
/// FileMissing if does not exist, InvalidArgument if the path leads outside the root directory, Success otherwise.
public PenumbraApiEc AddMod(string modDirectory);
/// Try to delete a mod given by its name or .
/// Note that success does only imply a successful call, not successful deletion.
/// NothingDone if the mod can not be found, Success otherwise.
public PenumbraApiEc DeleteMod(string modDirectory, string modName);
/// Triggers whenever a mod is deleted.
/// The base directory name of the deleted mod.
public event Action? ModDeleted;
/// Triggers whenever a mod is deleted.
/// The base directory name of the new mod.
public event Action? ModAdded;
/// Triggers whenever a mods base name is changed from inside Penumbra.
/// The previous base directory name of the mod and the new base directory name of the mod.
public event Action? ModMoved;
///
/// Get the internal full filesystem path including search order for the specified mod
/// given by its name or .
///
/// On Success, the full path, a bool indicating whether the entire path is default (true) or manually set (false),
/// and a bool indicating whether the sort order name ignoring the folder path is default (true) or manually set (false).
/// Otherwise, returns ModMissing if the mod can not be found.
public (PenumbraApiEc, string, bool, bool) GetModPath(string modDirectory, string modName);
///
/// Set the internal search order and filesystem path of the specified mod
/// given by its name or
/// to the .
///
/// InvalidArgument if is empty, ModMissing if the mod can not be found,
/// PathRenameFailed if could not be set or Success.
public PenumbraApiEc SetModPath(string modDirectory, string modName, string newPath);
/// Get the overall changed items of a single mod given by its name or , regardless of settings.
/// A possibly empty dictionary of affected items and known objects or null.
public Dictionary GetChangedItems(string modDirectory, string modName);
/// Get a dictionary of dictionaries to check all mods changed items.
/// A dictionary of mod identifier to changed item dictionary.
/// Throws an on access if the mod storage is not valid anymore, so clear this on .
public IReadOnlyDictionary> GetChangedItemAdapterDictionary();
/// Get a list of dictionaries to check all mods changed items.
/// A list all mods changed item dictionaries.
///
/// The order of mods is unspecified, but the same as in GetModList (assuming no changes in mods have taken place between calls).
/// Throws an on access if the mod storage is not valid anymore, so clear this on .
///
public IReadOnlyList<(string ModDirectory, IReadOnlyDictionary ChangedItems)> GetChangedItemAdapterList();
}