// SPDX-FileCopyrightText: 2026 FocusFlow contributors
// SPDX-License-Identifier: AGPL-3.0-only

part of '../../../application_management.dart';

/// Named distribution used by Backlog summary panels.
class BacklogDistributionReadModel {
  /// Creates a distribution with immutable [entries].
  BacklogDistributionReadModel({
    required this.title,
    required List<BacklogDistributionEntryReadModel> entries,
    int? totalCount,
  })  : entries = List<BacklogDistributionEntryReadModel>.unmodifiable(
          entries,
        ),
        totalCount = totalCount ??
            entries.fold<int>(0, (sum, entry) => sum + entry.count);

  /// Display title for this distribution.
  final String title;

  /// Total item count represented by [entries].
  final int totalCount;

  /// Ordered display entries.
  final List<BacklogDistributionEntryReadModel> entries;
}
