using Data.SeaHavenIndustries.Enums; namespace SeaHaven.Services.Helpers { public static class WorkOrderSeverityRules { public static bool TypeRequiresSeverity(WorkOrderType? type) => type is WorkOrderType.Emergency or WorkOrderType.Reactive; public static bool TryNormalize(string? value, out string? normalized) { normalized = null; if (string.IsNullOrWhiteSpace(value)) return true; var trimmed = value.Trim(); if (trimmed is "1" or "2" or "3" or "4" or "5") { normalized = trimmed; return true; } return false; } public static int? ParseLevel(string? stored) { if (!TryNormalize(stored, out var normalized) || normalized == null) return null; return int.Parse(normalized, System.Globalization.CultureInfo.InvariantCulture); } } }