part of 'print_struck_bloc.dart'; @freezed class PrintStruckState with _$PrintStruckState { const PrintStruckState._(); const factory PrintStruckState({ /// Status seluruh station di job cetak terakhir, urut sesuai urutan cetak. @Default([]) List stations, @Default(false) bool isPrinting, /// Order yang sedang dicetak, disimpan supaya station yang gagal bisa /// diulang tanpa perlu dikirim ulang dari halaman pemanggil. Order? order, /// Naik tiap job baru dimulai. UI memakainya untuk tahu kapan harus /// membuka dialog progres. @Default(0) int jobId, }) = _PrintStruckState; factory PrintStruckState.initial() => const PrintStruckState(); List get failedStations => stations.where((station) => station.isFailed).toList(); bool get hasFailure => failedStations.isNotEmpty; /// Station yang benar-benar dicetak — yang dilewati tidak ikut dihitung. int get plannedCount => stations.where((station) => !station.isSkipped).length; int get successCount => stations.where((station) => station.isSuccess).length; }