module history.model; import std.datetime.systime; struct History { ulong id; } enum HistoryItemType : string { TEXT = "TEXT" } HistoryItemType getHistoryItemType(string text) { import std.traits; static foreach (t; EnumMembers!HistoryItemType) { if (text == t) return t; } throw new Exception("Unknown history item type: " ~ text); } struct HistoryItem { ulong id; ulong historyId; SysTime timestamp; HistoryItemType type; } struct HistoryItemText { ulong itemId; string content; }