using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Capabilities;
namespace GroupVerifyApi;
///
/// Whether players are verified by GroupVerify: in the configured Steam group, or given a manual
/// override on the web panel. Get it in OnAllPluginsLoaded with
/// IGroupVerifyApi.Capability.Get(). Use it on the game thread only.
///
///
/// The object stays valid when GroupVerify is hot-reloaded, and event subscriptions stay attached.
/// While GroupVerify is unloaded, disabled or has no group set, is false and
/// nobody is verified.
///
public interface IGroupVerifyApi
{
/// The capability GroupVerify registers.
public static readonly PluginCapability Capability = new("groupverify:api");
///
/// True when GroupVerify is loaded, enabled, has a Steam group set and has read its database.
/// When false, every check returns not verified.
///
bool IsActive { get; }
///
/// Whether the player is verified. False for bots and players Steam hasn't authorized yet.
///
bool IsVerified(CCSPlayerController player);
/// Whether a SteamID64 is verified, online or not.
bool IsVerified(ulong steamId64);
/// Why a SteamID64 is or isn't verified, online or not.
VerifyStatus GetStatus(ulong steamId64);
///
/// Fired on the game thread when an online player's verified status changes: true when they
/// become verified (including right after connecting), false when they stop being verified
/// (they left the group, their override ran out, or GroupVerify was disabled). Not fired on
/// disconnect. After GroupVerify is hot-reloaded it fires true again for everyone verified,
/// so handlers should be idempotent.
///
event Action? OnVerifiedChanged;
///
/// The scoreboard clan tag for verified players who have no rank tag of their own (gv_settings
/// clan_tag, set with css_gv_clantag or the web panel), up to 12 characters, without brackets.
/// Empty when none is set, and while is false.
///
string ClanTag { get; }
///
/// Fired on the game thread when changes, including to or from empty as
/// GroupVerify is turned on or off, loaded or unloaded. Re-tag everyone when it fires.
///
event Action? OnClanTagChanged;
}
/// A player's verification, and why.
/// In the Steam group's member list.
/// Has an unexpired manual override.
/// When the override ends, in GroupVerify's database time zone; null if it never does (or there's none).
public readonly record struct VerifyStatus(bool InGroup, bool HasOverride, DateTime? OverrideExpires)
{
/// In the group, or has an override.
public bool Verified => InGroup || HasOverride;
}