using System.Globalization; using Houston.Resources; namespace Houston.Model.Documents; public enum DocumentType { ServiceProtocol, AcceptanceDocuments, SlaReportsTicketProcessing, MonitoringReports, SecurityAssessments, BillingData, ContractDocuments, } public static class DocumentTypeExtensions { public const string OtherDocumentsDisplayName = "Sonstige Dokumente"; public const string OtherDocumentsValue = "OtherDocuments"; public static string? FromStorageFolderName(string storageFolderName) => APITranslation.ResourceManager.GetString(storageFolderName, CultureInfo.InvariantCulture); public static DocumentType? ParseStorageFolderName(string storageFolderName) { var type = FromStorageFolderName(storageFolderName); if (!Enum.TryParse(type, ignoreCase: true, out var variant)) return null; return variant; } extension(DocumentType documentType) { /// /// The name of the S3 subfolder that holds documents of this type, i.e. the German translation. /// public string StorageFolderName => APITranslation.ResourceManager.GetString(documentType.ToString(), CultureInfo.InvariantCulture) ?? throw new NotImplementedException($"Missing translation for DocumentType '{documentType}'."); }