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

part of '../task_timeline_card.dart';

/// Private implementation type for `_CardColors` in this library.
/// It keeps supporting state and behavior scoped to the owning file so the public API stays focused on the scheduler concepts that callers use directly.
class _CardColors {
  /// Creates a `_CardColors` 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 _CardColors({
    required this.accent,
    required this.background,
    required this.reward,
  });

  /// Stores the `accent` 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 accent;

  /// Stores the `background` 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 background;

  /// Stores the `reward` 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 reward;

  /// Creates a `_CardColors.forKind` 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.
  factory _CardColors.forKind(TaskVisualKind kind) {
    return switch (kind) {
      TaskVisualKind.flexible => const _CardColors(
        accent: FocusFlowTokens.flexibleGreen,
        background: Color(0xCC021A0C),
        reward: FocusFlowTokens.flexibleGreen,
      ),
      TaskVisualKind.required => const _CardColors(
        accent: FocusFlowTokens.requiredPink,
        background: Color(0xCC230814),
        reward: FocusFlowTokens.requiredPink,
      ),
      TaskVisualKind.appointment => const _CardColors(
        accent: FocusFlowTokens.appointmentBlue,
        background: Color(0xCC031429),
        reward: FocusFlowTokens.appointmentBlue,
      ),
      TaskVisualKind.freeSlot => const _CardColors(
        accent: FocusFlowTokens.restPurple,
        background: Color(0xCC210A33),
        reward: FocusFlowTokens.restPurple,
      ),
      TaskVisualKind.completedSurprise => const _CardColors(
        accent: FocusFlowTokens.completedGray,
        background: Color(0xAA1C1D25),
        reward: FocusFlowTokens.restPurple,
      ),
    };
  }
}
