import 'package:flutter/material.dart';

import '../../../../common/theme/theme.dart';
import '../../../../domain/language/language.dart';

class LanguageTile extends StatelessWidget {
  final bool isSelected;
  final Language language;
  final Function() onTap;
  const LanguageTile({
    super.key,
    required this.isSelected,
    required this.language,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(bottom: 8),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(12),
        border: Border.all(
          color: isSelected ? AppColor.primary : AppColor.borderLight,
          width: isSelected ? 2 : 1,
        ),
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.05),
            blurRadius: 4,
            offset: const Offset(0, 2),
          ),
        ],
      ),
      child: ListTile(
        contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
        leading: Container(
          width: 48,
          height: 48,
          decoration: BoxDecoration(
            color: Colors.grey[100],
            borderRadius: BorderRadius.circular(24),
          ),
          child: Center(
            child: Text(language.path, style: const TextStyle(fontSize: 24)),
          ),
        ),
        title: Text(
          language.name,
          style: AppStyle.lg.copyWith(
            fontWeight: FontWeight.w600,

            color: isSelected ? AppColor.primary : AppColor.textPrimary,
          ),
        ),
        subtitle: Text(
          language.nativeName,
          style: AppStyle.md.copyWith(
            color: isSelected ? AppColor.primary : AppColor.textPrimary,
          ),
        ),
        trailing: isSelected
            ? Icon(Icons.check_circle, color: AppColor.primary, size: 24)
            : Icon(
                Icons.radio_button_unchecked,
                color: AppColor.textLight,
                size: 24,
              ),
        onTap: onTap,
      ),
    );
  }
}
