import 'package:flutter/material.dart';

import '../../../../common/data/refund_data.dart';
import '../../../components/spaces/space.dart';

class RefundReasonTile extends StatelessWidget {
  final bool isSelected;
  final RefundReason reason;
  final Function() onTap;
  const RefundReasonTile({
    super.key,
    required this.isSelected,
    required this.reason,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: AnimatedContainer(
        duration: const Duration(milliseconds: 300),
        decoration: BoxDecoration(
          color: isSelected ? reason.color.withOpacity(0.2) : Colors.grey[100],
          borderRadius: BorderRadius.circular(16),
          border: Border.all(
            color: isSelected ? reason.color : Colors.transparent,
            width: 2,
          ),
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(
              reason.icon,
              color: isSelected ? reason.color : Colors.grey[600],
              size: 20,
            ),
            const SpaceHeight(4),
            Text(
              reason.value,
              style: TextStyle(
                fontSize: 10,
                fontWeight: FontWeight.w600,
                color: isSelected ? reason.color : Colors.grey[600],
              ),
              textAlign: TextAlign.center,
            ),
          ],
        ),
      ),
    );
  }
}
