using Heron.MudCalendar; namespace WebApp.Models; /// /// Type discriminator for calendar item types. /// public enum CalendarItemType { Event, Meeting } /// /// Wrapper class for calendar items that can hold either a CalendarEventItem or CalendarMeetingItem. /// This allows MudCalendar to display mixed item types while maintaining type safety. /// public class CalendarItemWrapper : CalendarItem { /// /// Gets the type of calendar item this wrapper contains. /// public CalendarItemType ItemType { get; private set; } /// /// Gets the wrapped CalendarEventItem if ItemType is Event, otherwise null. /// public CalendarEventItem? EventItem { get; private set; } /// /// Gets the wrapped CalendarMeetingItem if ItemType is Meeting, otherwise null. /// public CalendarMeetingItem? MeetingItem { get; private set; } /// /// Parameterless constructor required by Heron.MudCalendar component. /// public CalendarItemWrapper() { // Initialize base class properties to avoid null reference issues Text = string.Empty; Start = DateTime.MinValue; End = DateTime.MinValue; } /// /// Creates a wrapper for a CalendarEventItem. /// public CalendarItemWrapper(CalendarEventItem eventItem) { ItemType = CalendarItemType.Event; EventItem = eventItem; // Delegate properties to wrapped item Text = eventItem.Text; Start = eventItem.Start; End = eventItem.End; } /// /// Creates a wrapper for a CalendarMeetingItem. /// public CalendarItemWrapper(CalendarMeetingItem meetingItem) { ItemType = CalendarItemType.Meeting; MeetingItem = meetingItem; // Delegate properties to wrapped item Text = meetingItem.Text; Start = meetingItem.Start; End = meetingItem.End; } }