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

class StatisticsCard extends StatelessWidget {
  final int totalCount;
  final int passCount;
  final int warningCount;
  final int failCount;

  const StatisticsCard({
    super.key,
    required this.totalCount,
    required this.passCount,
    required this.warningCount,
    required this.failCount,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(20.r),
      ),
      padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 16.h),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          _buildStatItem('总计', totalCount, const Color.fromRGBO(66, 165, 245, 1.0)),
          _buildStatItem('通过', passCount, const Color.fromRGBO(26, 188, 156, 1.0)),
          _buildStatItem('警告', warningCount, const Color.fromRGBO(247, 184, 75, 1.0)),
          _buildStatItem('不通过', failCount, const Color.fromRGBO(239, 68, 68, 1.0)),
        ],
      ),
    );
  }

  Widget _buildStatItem(String label, int count, Color color) {
    return Column(
      children: [
        Text(
          count.toString(),
          style: TextStyle(
            fontSize: 32.sp,
            fontWeight: FontWeight.bold,
            color: color,
          ),
        ),
        SizedBox(height: 4.h),
        Text(
          label,
          style: TextStyle(
            fontSize: 22.sp,
            color: const Color.fromRGBO(100, 116, 139, 1.0),
          ),
        ),
      ],
    );
  }
}
