Files
GmRelayBot/src/GmRelay.Shared/Domain/GroupManagerRole.cs
T
Toutsu 2529df4157
Deploy Telegram Bot / build-and-push (push) Successful in 3m51s
Deploy Telegram Bot / deploy (push) Successful in 11s
feat: support co-gm group delegation
2026-04-27 14:27:16 +03:00

35 lines
1.1 KiB
C#

namespace GmRelay.Shared.Domain;
public enum GroupManagerRole
{
Owner,
CoGm
}
public static class GroupManagerRoleExtensions
{
public const string OwnerValue = "Owner";
public const string CoGmValue = "CoGm";
public static string ToDatabaseValue(this GroupManagerRole role) => role switch
{
GroupManagerRole.Owner => OwnerValue,
GroupManagerRole.CoGm => CoGmValue,
_ => throw new ArgumentOutOfRangeException(nameof(role), role, "Unknown group manager role.")
};
public static GroupManagerRole FromDatabaseValue(string value) => value switch
{
OwnerValue => GroupManagerRole.Owner,
CoGmValue => GroupManagerRole.CoGm,
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown group manager role.")
};
public static string ToDisplayName(this GroupManagerRole role) => role switch
{
GroupManagerRole.Owner => "Owner",
GroupManagerRole.CoGm => "Co-GM",
_ => throw new ArgumentOutOfRangeException(nameof(role), role, "Unknown group manager role.")
};
}