import 'package:flutter/material.dart';
import '../../models/channel.dart';

class ChannelCircleItem extends StatelessWidget {
  final Channel channel;
  final VoidCallback onTap;

  const ChannelCircleItem({
    super.key,
    required this.channel,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: LayoutBuilder(
        builder: (ctx, constraints) {
          final size = constraints.maxWidth * 0.72;
          return Container(
            width: size,
            height: size,
            decoration: BoxDecoration(
              color: const Color(0xFF1C1C1E),
              shape: BoxShape.circle,
              border: Border.all(
                color: const Color(0xFF00C853).withOpacity(0.55),
                width: 2,
              ),
              boxShadow: [
                BoxShadow(
                  color: const Color(0xFF00C853).withOpacity(0.12),
                  blurRadius: 22,
                  spreadRadius: 2,
                ),
              ],
            ),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Icon(
                  channel.type == 'PUBLIC' ? Icons.radio : Icons.lock_outline,
                  color: const Color(0xFF00C853),
                  size: 22,
                ),
                const SizedBox(height: 8),
                Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 20),
                  child: Text(
                    channel.name,
                    style: const TextStyle(
                      color: Colors.white,
                      fontSize: 13,
                      fontWeight: FontWeight.bold,
                    ),
                    textAlign: TextAlign.center,
                    maxLines: 2,
                    overflow: TextOverflow.ellipsis,
                  ),
                ),
                const SizedBox(height: 4),
                Text(
                  channel.type == 'PUBLIC' ? 'عمومی' : 'خصوصی',
                  style: const TextStyle(color: Colors.white38, fontSize: 9),
                ),
              ],
            ),
          );
        },
      ),
    );
  }
}
