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

part of '../../application_commands.dart';

/// Hint for read models that should be refreshed after a command.
class ApplicationCommandReadHint {
  /// Creates a `ApplicationCommandReadHint` instance with the values required by its invariants.
  /// Callers should pass already-normalized scheduler data because validation and defaulting belong at the model or service boundary, not in arbitrary UI code.
  ApplicationCommandReadHint({
    CivilDate? localDate,
    Iterable<CivilDate> affectedDates = const <CivilDate>[],
    Iterable<String> affectedTaskIds = const <String>[],
    this.refreshToday = true,
  })  : localDate = localDate,
        affectedDates = List<CivilDate>.unmodifiable(
          {
            if (localDate != null) localDate,
            ...affectedDates,
          },
        ),
        affectedTaskIds = List<String>.unmodifiable(affectedTaskIds);

  /// Primary local date for a Today refresh, when known.
  final CivilDate? localDate;

  /// All local dates touched by the command.
  final List<CivilDate> affectedDates;

  /// Task ids changed or created by the command.
  final List<String> affectedTaskIds;

  /// Whether Today-style read models should be refreshed.
  final bool refreshToday;
}
