import 'package:flutter/material.dart';
import '../../constants.dart';
import 'sensitivity_theme.dart';

/// Small pill-style badge used across the mitra app to indicate a sensitive session.
/// Renders nothing for regular sessions.
class SensitivityBadge extends StatelessWidget {
  final TopicSensitivity sensitivity;
  final double fontSize;
  final EdgeInsets padding;

  const SensitivityBadge({
    super.key,
    required this.sensitivity,
    this.fontSize = 11,
    this.padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
  });

  @override
  Widget build(BuildContext context) {
    if (sensitivity != TopicSensitivity.sensitive) return const SizedBox.shrink();
    const theme = SensitivityTheme.sensitive;
    return Container(
      padding: padding,
      decoration: BoxDecoration(
        color: theme.badgeBg,
        borderRadius: BorderRadius.circular(999),
      ),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          Icon(Icons.warning_amber_rounded, size: fontSize + 2, color: theme.badgeFg),
          const SizedBox(width: 4),
          Text(
            'Topik sensitif',
            style: TextStyle(
              color: theme.badgeFg,
              fontSize: fontSize,
              fontWeight: FontWeight.w600,
            ),
          ),
        ],
      ),
    );
  }
}
