"""
Smart Task Scheduler
Generated by Eden via recursive self-improvement
2025-10-28 17:44:40.877362
"""

class TaskScheduler:
    def __init__(self):
        self.tasks = {}  # key: time string (HH:MM), value: list of task names

    def add_task(self, task_name, times):
        """
        Adds a new task to be performed at specified times daily.
        
        Args:
            task_name (str): Name/description of the task
            times (list of str): List of time strings in "HH:MM" format
        """
        for time_str in times:
            if self._is_valid_time(time_str):
                hour, minute = map(int, time_str.split(':'))
                total_minutes = hour * 60 + minute
                if time_str not in self.tasks:
                    self.tasks[time_str] = []
                self.tasks[time_str].append(task_name)
            else:
                print(f"Invalid time format: {time_str}")

    def get_tasks(self, current_time):
        """
        Retrieves tasks scheduled at the specified current_time.
        
        Args:
            current_time (str): Time string in "HH:MM" format
            
        Returns:
            list of str: Tasks scheduled at current_time, or empty list if none
        """
        if self._is_valid_time(current_time):
            hour, minute = map(int, current_time.split(':'))
            total_minutes_current = hour * 60 + minute
            for time_str in sorted(self.tasks.keys()):
                stored_hour, stored_minute = map(int, time_str.split(':'))
                total_minutes_stored = stored_hour * 60 + stored_minute
                if total_minutes_stored == total_minutes_current:
                    return self.tasks[time_str]
        return []

    def _is_valid_time(self, time_str):
        """
        Validates that the input string is in "HH:MM" format.
        
        Args:
            time_str (str): Time string to validate
            
        Returns:
            bool: True if valid, False otherwise
        """
        try:
            hour, minute = map(int, time_str.split(':'))
            return 0 <= hour < 24 and 0 <= minute < 60
        except ValueError:
            return False

# Example usage:
if __name__ == "__main__":
    task_scheduler = TaskScheduler()
    
    # Adding tasks with multiple times
    task_scheduler.add_task("Exercise", ["09:30", "17:30"])
    task_scheduler.add_task("Dinner with Alice", ["18:30"])
    
    print(task_scheduler.get_tasks("09:30"))  # Output: ['Exercise']
    print(task_scheduler.get_tasks("17:30"))  # Output: ['Exercise']
    print(task_scheduler.get_tasks("18:30"))  # Output: ['Dinner with Alice']
    print(task_scheduler.get_tasks("12:00"))  # Output: []