| 1 | namespace IntercomService.Data; |
| 2 | |
| 3 | public static class MemberKinds |
| 4 | { |
| 5 | public const string Human = "human"; |
| 6 | public const string Agent = "agent"; |
| 7 | public const string System = "system"; |
| 8 | } |
| 9 | |
| 10 | public static class TeamRoles |
| 11 | { |
| 12 | public const string Owner = "owner"; |
| 13 | public const string Admin = "admin"; |
| 14 | public const string Member = "member"; |
| 15 | public const string Guest = "guest"; |
| 16 | public const string Agent = "agent"; |
| 17 | |
| 18 | public static readonly HashSet<string> All = new(StringComparer.Ordinal) |
| 19 | { |
| 20 | Owner, Admin, Member, Guest, Agent, |
| 21 | }; |
| 22 | |
| 23 | public static bool IsOwnerOrAdmin(string role) => |
| 24 | string.Equals(role, Owner, StringComparison.Ordinal) |
| 25 | || string.Equals(role, Admin, StringComparison.Ordinal); |
| 26 | |
| 27 | public static int Rank(string role) => role switch |
| 28 | { |
| 29 | Owner => 100, |
| 30 | Admin => 80, |
| 31 | Member => 50, |
| 32 | Guest => 20, |
| 33 | Agent => 10, |
| 34 | _ => 0, |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | public static class JoinPolicies |
| 39 | { |
| 40 | public const string InviteRequired = "invite_required"; |
| 41 | public const string GitHubOrg = "github_org"; |
| 42 | public const string FirstOwner = "first_owner"; |
| 43 | public const string Open = "open"; |
| 44 | } |
| 45 | |