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

part of '../task_selection_modal.dart';

/// Private implementation type for `_ModalStatusButton` in this library.
/// It adapts modal sizing and labels to the shared status-circle button.
class _ModalStatusButton extends StatelessWidget {
  /// Creates a `_ModalStatusButton` 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 _ModalStatusButton({
    required this.card,
    required this.color,
    required this.onPressed,
  });

  /// Stores the `card` value for this object.
  /// This field is part of the explicit state that downstream scheduling, persistence, or UI code reads when composing behavior.
  final TimelineCardModel card;

  /// Stores the `color` value for this object.
  /// This field is part of the explicit state that downstream scheduling, persistence, or UI code reads when composing behavior.
  final Color color;

  /// Stores the `onPressed` value for this object.
  /// This field is part of the explicit state that downstream scheduling, persistence, or UI code reads when composing behavior.
  final VoidCallback? onPressed;

  /// Builds the widget subtree for this component.
  /// The method translates the current widget configuration and state into Flutter UI without mutating scheduler domain data.
  @override
  Widget build(BuildContext context) {
    return StatusCircleButton(
      circleKey: const ValueKey('task-modal-status'),
      color: color,
      checkColor: FocusFlowTokens.appBackground,
      isCompleted: card.isCompleted,
      size: 44,
      borderWidth: 4,
      iconSize: 26,
      hoverBlurRadius: 12,
      semanticLabel: card.isCompleted
          ? 'Mark ${card.title} not done'
          : 'Mark ${card.title} complete',
      onPressed: onPressed,
    );
  }
}
