35 lines
1.1 KiB
C#
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.")
|
|
};
|
|
}
|