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

part of '../application_recovery.dart';

/// Request for explicit app-open/start-day rollover recovery.
class RunAppOpenRecoveryRequest {
  /// Creates a `RunAppOpenRecoveryRequest` 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.
  const RunAppOpenRecoveryRequest({
    required this.context,
    required this.sourceDate,
    this.targetDate,
  });

  /// Atomic operation context.
  final ApplicationOperationContext context;

  /// Owner-local day to inspect for unfinished flexible work.
  final CivilDate sourceDate;

  /// Owner-local target day. Defaults to the next local day.
  final CivilDate? targetDate;

  /// Resolved target day.
  CivilDate get resolvedTargetDate => targetDate ?? sourceDate.addDays(1);
}
