// Enum per lo stato del task
enum TaskStatus { open, inProgress, completed }

extension TaskStatusExtension on TaskStatus {
  String get name {
    switch (this) {
      case TaskStatus.open:
        return 'Da Iniziare';
      case TaskStatus.inProgress:
        return 'In Lavorazione';
      case TaskStatus.completed:
        return 'Completato';
    }
  }

  // Comodo per mappare da Supabase
  static TaskStatus fromString(String? status) {
    switch (status) {
      case 'in_progress':
        return TaskStatus.inProgress;
      case 'completed':
        return TaskStatus.completed;
      case 'open':
      default:
        return TaskStatus.open;
    }
  }

  // Comodo per salvare su Supabase
  String get toValue {
    switch (this) {
      case TaskStatus.open:
        return 'open';
      case TaskStatus.inProgress:
        return 'in_progress';
      case TaskStatus.completed:
        return 'completed';
    }
  }
}
