using cfs_tracker.Models; namespace cfs_tracker.Helpers; public static class HealthStateExtensions { public static string ToAppearanceColorKey(this HealthState state) => state switch { HealthState.Green => AppearanceKeys.StateGreen, HealthState.Yellow => AppearanceKeys.StateYellow, HealthState.Red => AppearanceKeys.StateRed, HealthState.Gray => AppearanceKeys.StateGray, _ => AppearanceKeys.StateGray }; public static string ToAppearanceTextKey(this HealthState state) => state switch { HealthState.Green => AppearanceKeys.StatusGreenText, HealthState.Yellow => AppearanceKeys.StatusYellowText, HealthState.Red => AppearanceKeys.StatusRedText, HealthState.Gray => AppearanceKeys.StatusGrayText, _ => AppearanceKeys.StatusGrayText }; public static string ToFallbackText(this HealthState state) => state switch { HealthState.Green => "GrĂ¼n", HealthState.Yellow => "Gelb", HealthState.Red => "Rot", HealthState.Gray => "Schwarz", _ => "Schwarz" }; public static int ToScore(this HealthState state) => state switch { HealthState.Green => 3, HealthState.Yellow => 2, HealthState.Red => 1, HealthState.Gray => 0, _ => 0 }; }