import 'package:flutter/material.dart';
import '../../../core/theme/design_tokens.dart';
import '../toast/toast_type.dart';
import '../toast/toast_type_config.dart' show ToastTypeConfig;

class AppBanner extends StatelessWidget {
  final String message;
  final ToastType type;
  final bool visible;

  const AppBanner({
    super.key,
    required this.message,
    this.type = ToastType.warning,
    this.visible = true,
  });

  @override
  Widget build(BuildContext context) {
    if (!visible) return const SizedBox.shrink();

    final config = ToastTypeConfig.fromType(type);

    return Container(
      width: double.infinity,
      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
      decoration: BoxDecoration(
        color: config.backgroundColor,
        borderRadius: BorderRadius.circular(AppRadius.sm),
      ),
      child: Row(
        children: [
          Icon(config.icon, size: 16, color: config.iconColor),
          const SizedBox(width: 8),
          Expanded(
            child: Text(
              message,
              style: TextStyle(fontSize: 13, color: config.textColor),
            ),
          ),
        ],
      ),
    );
  }
}
