using System; using System.Collections.Generic; using Content.Server.Voting.Managers; using Robust.Server.Player; namespace Content.Server.Voting { /// /// A handle to vote, active or past. /// /// /// /// Vote options are referred to by UI/networking as integer IDs. /// These IDs are the index of the vote option in the list /// used to create the vote. /// /// public interface IVoteHandle { /// /// The numeric ID of the vote. Can be used in . /// int Id { get; } /// /// The title of the vote. /// string Title { get; } /// /// Text representing who/what initiated the vote. /// string InitiatorText { get; } /// /// Whether the vote has finished and is no longer active. /// bool Finished { get; } /// /// Whether the vote was cancelled by an administrator and did not finish naturally. /// /// /// If this is true, is also true. /// bool Cancelled { get; } /// /// Current count of votes per option type. /// IReadOnlyDictionary VotesPerOption { get; } /// /// Invoked when this vote has successfully finished. /// event VoteFinishedEventHandler OnFinished; /// /// Invoked if this vote gets cancelled. /// event VoteCancelledEventHandler OnCancelled; /// /// Check whether a certain integer option ID is valid. /// /// The integer ID of the option. /// True if the option ID is valid, false otherwise. bool IsValidOption(int optionId); /// /// Cast a vote for a specific player. /// /// The player session to vote for. /// /// The integer option ID to vote for. If null, "no vote" is selected (abstaining). /// /// /// is not a valid option ID. /// void CastVote(IPlayerSession session, int? optionId); /// /// Cancel this vote. /// void Cancel(); } }