using Dalamud.Game;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects.SubKinds;
namespace Dalamud.Plugin.Services;
///
/// This class represents the state of the game client at the time of access.
///
public interface IClientState
{
///
/// A delegate type used for the event.
///
/// The new ClassJob id.
public delegate void ClassJobChangeDelegate(uint classJobId);
///
/// A delegate type used for the event.
///
/// The ClassJob id.
/// The level of the corresponding ClassJob.
public delegate void LevelChangeDelegate(uint classJobId, uint level);
///
/// A delegate type used for the event.
///
/// The type of logout.
/// The success/failure code.
public delegate void LogoutDelegate(int type, int code);
///
/// Event that gets fired when the current Territory changes.
///
public event Action TerritoryChanged;
///
/// Event that gets fired when the current Map changes.
///
public event Action MapChanged;
///
/// Event that fires when a characters ClassJob changed.
///
public event ClassJobChangeDelegate? ClassJobChanged;
///
/// Event that fires when any character level changes, including levels
/// for a not-currently-active ClassJob (e.g. PvP matches, DoH/DoL).
///
public event LevelChangeDelegate? LevelChanged;
///
/// Event that fires when a character is logging in, and the local character object is available.
///
public event Action Login;
///
/// Event that fires when a character is logging out.
///
public event LogoutDelegate Logout;
///
/// Event that fires when a character is entering PvP.
///
public event Action EnterPvP;
///
/// Event that fires when a character is leaving PvP.
///
public event Action LeavePvP;
///
/// Event that gets fired when a duty is ready.
///
public event Action CfPop;
///
/// Gets the language of the client.
///
public ClientLanguage ClientLanguage { get; }
///
/// Gets the current Territory the player resides in.
///
public ushort TerritoryType { get; }
///
/// Gets the current Map the player resides in.
///
public uint MapId { get; }
///
/// Gets the local player character, if one is present.
///
public IPlayerCharacter? LocalPlayer { get; }
///
/// Gets the content ID of the local character.
///
public ulong LocalContentId { get; }
///
/// Gets a value indicating whether a character is logged in.
///
public bool IsLoggedIn { get; }
///
/// Gets a value indicating whether the user is playing PvP.
///
public bool IsPvP { get; }
///
/// Gets a value indicating whether the user is playing PvP, excluding the Wolves' Den.
///
public bool IsPvPExcludingDen { get; }
///
/// Gets a value indicating whether the client is currently in Group Pose (GPose) mode.
///
public bool IsGPosing { get; }
///
/// Check whether the client is currently "idle". This means a player is not logged in, or is notctively in combat
/// or doing anything that we may not want to disrupt.
///
/// An outvar containing the first observed condition blocking the "idle" state. 0 if idle.
/// Returns true if the client is idle, false otherwise.
public bool IsClientIdle(out ConditionFlag blockingFlag);
///
/// Check whether the client is currently "idle". This means a player is not logged in, or is notctively in combat
/// or doing anything that we may not want to disrupt.
///
/// Returns true if the client is idle, false otherwise.
public bool IsClientIdle() => this.IsClientIdle(out _);
}