namespace NATS.Server.Raft;

/// <summary>
/// Go-style state string rendering for <see cref="RaftState"/>.
/// Go reference: server/raft.go RaftState.String().
/// </summary>
public static class RaftStateExtensions
{
    public static string String(this RaftState state) =>
        state switch
        {
            RaftState.Follower => "Follower",
            RaftState.Leader => "Leader",
            RaftState.Candidate => "Candidate",
            RaftState.Closed => "Closed",
            _ => "Unknown",
        };
}
