import 'dart:collection';

import 'package:asciineverdie/src/core/model/task_info.dart';

/// 큐 종류 (Queue Kind)
enum QueueKind { task, plot }

/// 큐 엔트리 (Queue Entry)
class QueueEntry {
  const QueueEntry({
    required this.kind,
    required this.durationMillis,
    required this.caption,
    this.taskType = TaskType.neutral,
  });

  final QueueKind kind;
  final int durationMillis;
  final String caption;
  final TaskType taskType;
}

/// 큐 상태 (Queue State)
///
/// 대기 중인 태스크/플롯 이벤트 큐를 관리
class QueueState {
  QueueState({Iterable<QueueEntry>? entries})
    : entries = Queue<QueueEntry>.from(entries ?? const []);

  final Queue<QueueEntry> entries;

  factory QueueState.empty() => QueueState(entries: const []);

  QueueState copyWith({Iterable<QueueEntry>? entries}) {
    return QueueState(entries: Queue<QueueEntry>.from(entries ?? this.entries));
  }
}
