import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';

/// A row of statistic cards for shift details (Total Pay, Rate, Hours).
class ShiftStatsRow extends StatelessWidget {
  /// Estimated total pay for the shift.
  final double estimatedTotal;
  
  /// Hourly rate for the shift.
  final double hourlyRate;
  
  /// Total duration of the shift in hours.
  final double duration;
  
  /// Localization string for total.
  final String totalLabel;
  
  /// Localization string for hourly rate.
  final String hourlyRateLabel;
  
  /// Localization string for hours.
  final String hoursLabel;

  /// Creates a [ShiftStatsRow].
  const ShiftStatsRow({
    super.key,
    required this.estimatedTotal,
    required this.hourlyRate,
    required this.duration,
    required this.totalLabel,
    required this.hourlyRateLabel,
    required this.hoursLabel,
  });

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(UiConstants.space5),
      child: Row(
        children: [
          Expanded(
            child: _buildStatCard(
              UiIcons.dollar,
              "\$${estimatedTotal.toStringAsFixed(0)}",
              totalLabel,
            ),
          ),
          const SizedBox(width: UiConstants.space4),
          Expanded(
            child: _buildStatCard(
              UiIcons.dollar,
              "\$${hourlyRate.toStringAsFixed(0)}",
              hourlyRateLabel,
            ),
          ),
          const SizedBox(width: UiConstants.space4),
          Expanded(
            child: _buildStatCard(
              UiIcons.clock,
              duration.toStringAsFixed(1),
              hoursLabel,
            ),
          ),
        ],
      ),
    );
  }

  Widget _buildStatCard(IconData icon, String value, String label) {
    return Container(
      padding: const EdgeInsets.symmetric(vertical: UiConstants.space3),
      decoration: BoxDecoration(
        color: UiColors.bgThird,
        borderRadius: BorderRadius.circular(UiConstants.radiusBase),
      ),
      child: Column(
        children: [
          Container(
            width: 40,
            height: 40,
            decoration: const BoxDecoration(
              color: UiColors.white,
              shape: BoxShape.circle,
            ),
            child: Icon(icon, size: 20, color: UiColors.textSecondary),
          ),
          const SizedBox(height: UiConstants.space2),
          Text(
            value,
            style: UiTypography.title1m
                .copyWith(fontWeight: FontWeight.w700)
                .textPrimary,
          ),
          Text(label, style: UiTypography.footnote2r.textSecondary),
        ],
      ),
    );
  }
}
