using Glamourer.Api.Enums;
using Newtonsoft.Json.Linq;
namespace Glamourer.Api.Api;
/// Any functions related to Glamourer's state tracking.
public interface IGlamourerApiState
{
/// Get the current Glamourer state of an actor.
/// The game object index of the desired actor.
/// A key to unlock the state if necessary.
/// ActorNotFound, InvalidKey or Success, and the state on success.
/// The actor does not need to have a prior Glamourer state as long as it can be found.
public (GlamourerApiEc, JObject?) GetState(int objectIndex, uint key);
/// Get the current Glamourer state of a player character.
/// The name of the desired player.
/// A key to unlock the state if necessary.
/// ActorNotFound, InvalidKey or Success, and the state on success.
///
/// The player does not have to be currently available as long as he has a persisted Glamourer state.
/// Only players are checked for name equality, no NPCs.
/// If multiple players of the same name are found, the first is returned.
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
///
public (GlamourerApiEc, JObject?) GetStateName(string playerName, uint key);
///
public (GlamourerApiEc, string?) GetStateBase64(int objectIndex, uint key);
///
public (GlamourerApiEc, string?) GetStateBase64Name(string objectName, uint key);
/// Apply a supplied state to an actor.
/// The state, which can be either a Glamourer-supplied JObject or a Base64 string.
/// The game object index of the actor to be manipulated.
/// A key to unlock or lock the state if necessary.
/// The flags used for the application. Respects Once, Equipment, Customization and Lock (see .)
/// ActorNotFound, InvalidKey, ActorNotHuman, Success.
public GlamourerApiEc ApplyState(object applyState, int objectIndex, uint key, ApplyFlag flags);
/// Apply a supplied state to players.
/// The state, which can be either a Glamourer-supplied JObject or a Base64 string.
/// The name of the player to be manipulated.
/// A key to unlock or lock the state if necessary.
/// The flags used for the application. Respects Once, Equipment, Customization and Lock (see .)
/// ActorNotFound, InvalidKey, ActorNotHuman, Success.
///
/// The player does not have to be currently available as long as he has a persisted Glamourer state.
/// Only players are checked for name equality, no NPCs.
/// If multiple players of the same name are found, all of them are manipulated.
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
///
public GlamourerApiEc ApplyStateName(object applyState, string playerName, uint key, ApplyFlag flags);
/// Revert the Glamourer state of an actor to Game state.
/// The game object index of the actor to be manipulated.
/// A key to unlock the state if necessary.
/// The flags used for the reversion. Respects Equipment and Customization (see .)
/// ActorNotFound, InvalidKey, Success, NothingDone.
public GlamourerApiEc RevertState(int objectIndex, uint key, ApplyFlag flags);
/// Revert the Glamourer state of players to game state.
/// The name of the players to be reverted.
/// A key to unlock the state if necessary.
/// The flags used for the reversion. Respects Equipment and Customization (see .)
/// ActorNotFound, InvalidKey, Success, NothingDone.
/// ///
/// The player does not have to be currently available as long as he has a persisted Glamourer state.
/// Only players are checked for name equality, no NPCs.
/// If multiple players of the same name are found, all of them are reverted.
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
///
public GlamourerApiEc RevertStateName(string playerName, uint key, ApplyFlag flags);
/// Unlock the Glamourer state of an actor with a key.
/// The game object index of the actor to be manipulated.
/// A key to unlock the state.
/// ActorNotFound, InvalidKey, Success, NothingDone.
public GlamourerApiEc UnlockState(int objectIndex, uint key);
/// Unlock the Glamourer state of players with a key.
/// The name of the players to be unlocked.
/// A key to unlock the state.
/// InvalidKey, Success, NothingDone.
public GlamourerApiEc UnlockStateName(string playerName, uint key);
/// Unlock all active glamourer states with a key.
/// The key to unlock states with.
/// The number of unlocked states.
public int UnlockAll(uint key);
/// Revert the Glamourer state of an actor to automation state.
/// The game object index of the actor to be manipulated.
/// A key to unlock the state if necessary.
/// The flags used for the reversion. Respects Once and Lock (see .)
/// ActorNotFound, InvalidKey, Success, NothingDone.
public GlamourerApiEc RevertToAutomation(int objectIndex, uint key, ApplyFlag flags);
/// Revert the Glamourer state of players to automation state.
/// The name of the players to be reverted.
/// A key to unlock the state if necessary.
/// The flags used for the reversion. Respects Once and Lock (see .)
/// ActorNotFound, InvalidKey, Success, NothingDone.
/// ///
/// The player does not have to be currently available as long as he has a persisted Glamourer state.
/// Only players are checked for name equality, no NPCs.
/// If multiple players of the same name are found, all of them are reverted.
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
///
public GlamourerApiEc RevertToAutomationName(string playerName, uint key, ApplyFlag flags);
/// Invoked with the game object pointer (if available) whenever an actors tracked state changes.
public event Action StateChanged;
/// Invoked with the game object pointer (if available) whenever an actors tracked state changes, with the type of change.
public event Action StateChangedWithType;
/// Invoked with the game object pointer (if available) whenever an actors tracked state finalizes a grouped change consisting of multiple smaller changes.
public event Action StateFinalized;
/// Invoked when the player enters or leaves GPose (true => entered GPose, false => left GPose).
public event Action? GPoseChanged;
}