import React from 'react';
import WeeklyTaskItem from './WeeklyTaskItem';

interface Task {
  id: string;
  title: string;
  description?: string;
  completed: boolean;
  startTime?: string;
  endTime?: string;
  dayOfWeek?: number; // 0 = Sunday, 1 = Monday, etc.
}

interface TaskListProps {
  tasks: Task[];
  onTaskClick?: (task: Task) => void;
}

const TaskList: React.FC<TaskListProps> = ({ tasks, onTaskClick }) => {
  if (tasks.length === 0) {
    return (
      <div className="empty-state">
        <p>No tasks found</p>
      </div>
    );
  }

  return (
    <ul className="task-list">
      {tasks.map((task) => (
        <li key={task.id}>
          <WeeklyTaskItem 
            task={task} 
            onClick={() => onTaskClick?.(task)} 
          />
        </li>
      ))}
    </ul>
  );
};

export default TaskList;