using Health.Domain.Enums;

namespace Health.Application.Medications;

public static class MedicationScheduleStatus
{
    public static string Resolve(
        TimeOnly scheduledTime,
        TimeOnly currentTime,
        MedicationLogStatus? logStatus)
    {
        if (logStatus.HasValue)
            return logStatus == MedicationLogStatus.Taken ? "taken" : "skipped";
        if (scheduledTime <= currentTime.AddMinutes(-30)) return "overdue";
        if (scheduledTime <= currentTime.AddHours(3)) return "upcoming";
        return "scheduled";
    }
}
