using WorkTracker.Domain;

namespace WorkTracker.Formatting;

public static class CalendarEventFormatter
{
    public static string GetDisplayDescription(CalendarEventDocument calendarEvent)
    {
        return GetDisplayDescription(calendarEvent.EventType, calendarEvent.Description);
    }

    public static string GetDisplayDescription(CalendarEventType eventType, string? description)
    {
        return string.IsNullOrWhiteSpace(description)
            ? GetEventTypeName(eventType)
            : description.Trim();
    }

    public static string GetEventTypeName(CalendarEventType eventType)
    {
        return eventType switch
        {
            CalendarEventType.DayOff => "Day Off",
            _ => eventType.ToString()
        };
    }
}