Resource.cs 885 B

12345678910111213141516171819202122232425262728293031
  1. namespace RackPeek.Domain.Resources;
  2. public abstract class Resource
  3. {
  4. private static readonly Dictionary<string, string> KindToPluralDictionary = new()
  5. {
  6. { "hardware", "hardware" },
  7. { "server", "servers" },
  8. { "switch", "switches" },
  9. { "firewall", "firewalls" },
  10. { "router", "routers" },
  11. { "accesspoint", "accesspoints" },
  12. { "desktop", "desktops" },
  13. { "laptop", "laptops" },
  14. { "ups", "ups" },
  15. { "system", "systems" },
  16. { "service", "services" }
  17. };
  18. public string Kind { get; set; } = string.Empty;
  19. public required string Name { get; set; }
  20. public string[]? Tags { get; set; } = [];
  21. public string? Notes { get; set; }
  22. public static string KindToPlural(string kind)
  23. {
  24. return KindToPluralDictionary.GetValueOrDefault(kind.ToLower().Trim(), kind);
  25. }
  26. }