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

part of '../quick_capture.dart';

/// Input for low-friction task capture.
///
/// This object represents what the UI knows at the moment of capture. It mirrors
/// the product goal: adding a thought should require as little structure as
/// possible, but the user can optionally provide enough detail to immediately
/// schedule it into the next open flexible slot.
class QuickCaptureRequest {
  /// Creates a `QuickCaptureRequest` 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.
  QuickCaptureRequest({
    required this.id,
    required this.title,
    required this.createdAt,
    this.addToNextAvailableSlot = false,
    this.projectId = 'inbox',
    this.priority = PriorityLevel.medium,
    this.reward = RewardLevel.notSet,
    this.difficulty = DifficultyLevel.notSet,
    this.type = TaskType.flexible,
    this.durationMinutes,
    Set<BacklogTag> backlogTags = const <BacklogTag>{},
  }) : backlogTags = Set<BacklogTag>.unmodifiable(backlogTags);

  /// Caller-generated id. Keeping id generation outside this service makes the
  /// domain layer independent from persistence/database choices.
  final String id;

  /// Raw user-entered title. The [Task.quickCapture] factory trims it.
  final String title;

  /// Capture timestamp supplied by the caller for testability.
  final DateTime createdAt;

  /// Whether capture should attempt immediate timeline placement.
  final bool addToNextAvailableSlot;

  /// Project id to assign; defaults to the inbox for uncategorized thoughts.
  final String projectId;

  /// Initial priority used by backlog/scheduler heuristics.
  final PriorityLevel priority;

  /// Initial reward estimate.
  final RewardLevel reward;

  /// Initial difficulty estimate.
  final DifficultyLevel difficulty;

  /// Captured task type. Immediate scheduling currently requires flexible tasks.
  final TaskType type;

  /// Optional duration estimate. Required only when scheduling immediately.
  final int? durationMinutes;

  /// Optional backlog flags such as wishlist/someday.
  final Set<BacklogTag> backlogTags;
}
