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

part of '../top_bar.dart';

/// Private implementation type for `_SettingsButton` 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 _SettingsButton extends StatelessWidget {
  /// Creates a `_SettingsButton` 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 _SettingsButton({required this.metrics});

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

  /// 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 OutlinedButton(
      onPressed: () {},
      style: OutlinedButton.styleFrom(
        foregroundColor: FocusFlowTokens.textPrimary,
        side: BorderSide(
          color: FocusFlowTokens.subtleBorder,
          width: metrics.borderWidth,
        ),
        fixedSize: Size(metrics.settingsWidth, metrics.settingsHeight),
        minimumSize: Size.zero,
        padding: metrics.buttonPadding,
        tapTargetSize: MaterialTapTargetSize.shrinkWrap,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(metrics.borderRadius),
        ),
      ),
      child: FittedBox(
        fit: BoxFit.scaleDown,
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            Icon(Icons.wb_sunny_outlined, size: metrics.settingsIconSize),
            SizedBox(width: metrics.settingsTextGap),
            Text(
              'Settings',
              style: TextStyle(
                fontSize: metrics.settingsTextSize,
                fontWeight: FontWeight.w600,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
