using Penumbra.Api.Enums;
namespace Penumbra.Api.Api;
/// API methods pertaining to collection management.
public interface IPenumbraApiCollection
{
/// A list of the GUIDs of all currently installed collections together with their display names, excluding the empty collection.
public Dictionary GetCollections();
/// Returns all collections for which either
///
/// - the name is equal to the given identifier up to case,
/// - the identifier is parsable to a GUID and the GUID corresponds to an existing collection,
/// - or the identifier is at least 8 characters long and the GUID as a hex-string starts with the identifier.
///
///
public List<(Guid Id, string Name)> GetCollectionsByIdentifier(string identifier);
/// A dictionary of affected items in via GUID and known objects or null.
public Dictionary GetChangedItemsForCollection(Guid collectionId);
/// The GUID and name of the collection assigned to the given , the empty GUID for the empty collection, or null if nothing is assigned.
public (Guid Id, string Name)? GetCollection(ApiCollectionType type);
/// Return whether the object at produces a valid identifier, if the identifier has a collection assigned, and the collection that affects the object.
public (bool ObjectValid, bool IndividualSet, (Guid Id, string Name) EffectiveCollection) GetCollectionForObject(int gameObjectIdx);
///
/// Set a collection by GUID for a specific type.
///
/// The collection type to set.
/// The GUID of the collection to set it to, null to remove the association if allowed.
/// Allow only setting existing types or also creating an unset type.
/// Allow deleting existing collections if is empty.
/// InvalidArgument if type is invalid,
/// NothingChanged if the new collection is the same as the old,
/// AssignmentDeletionDisallowed if is null and is false, and the assignment exists,
/// or if Default, Current or Interface would be deleted.
/// CollectionMissing if the new collection can not be found,
/// AssignmentCreationDisallowed if is false and the assignment does not exist,
/// or Success, as well as the GUID of the previous collection (empty if no assignment existed).
///
public (PenumbraApiEc, (Guid Id, string Name)? OldCollection) SetCollection(ApiCollectionType type, Guid? collectionId, bool allowCreateNew,
bool allowDelete);
///
/// Set a collection by GUID for a specific game object.
///
/// The index of the desired game object in the object table.
/// The GUID of the collection to set it to, null to remove the association if allowed.
/// Allow only setting existing individuals or also creating a new individual assignment.
/// Allow deleting existing individual assignments if is null.
/// InvalidIdentifier if does not produce an existing game object or the object is not identifiable,
/// NothingChanged if the new collection is the same as the old,
/// AssignmentDeletionDisallowed if is null and is false, and the assignment exists,
/// CollectionMissing if the new collection can not be found,
/// AssignmentCreationDisallowed if is false and the assignment does not exist,
/// or Success, as well as the name of the previous collection (empty if no assignment existed).
public (PenumbraApiEc, (Guid Id, string Name)? OldCollection) SetCollectionForObject(int gameObjectIdx, Guid? collectionId, bool allowCreateNew,
bool allowDelete);
/// Obtain a function object that can check if the current collection contains a given changed item by listing the mods changing it.
/// Throws an on invocation if the collection storage is not valid anymore, so clear this on .
public Func CheckCurrentChangedItemFunc();
}