import 'package:flutter/material.dart';
import '../theme/app_colors.dart';
import '../theme/app_text_styles.dart';
import '../theme/app_radius.dart';
import '../theme/app_spacing.dart';
import 'fs_badge.dart';

class ScenarioCard extends StatelessWidget {
  final String title;
  final String? description;
  final String? riskLevel;
  final String? difficulty;
  final String? eventType;
  final VoidCallback? onTap;

  const ScenarioCard({
    super.key,
    required this.title,
    this.description,
    this.riskLevel,
    this.difficulty,
    this.eventType,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Material(
      color: AppColors.panel,
      borderRadius: AppRadius.mdAll,
      child: InkWell(
        onTap: onTap,
        borderRadius: AppRadius.mdAll,
        child: Container(
          padding: AppSpacing.cardInner,
          decoration: BoxDecoration(
            border: Border.all(color: AppColors.border),
            borderRadius: AppRadius.mdAll,
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                title,
                style: AppTextStyles.titleSmall,
                maxLines: 2,
                overflow: TextOverflow.ellipsis,
              ),
              if (description != null) ...[
                AppSpacing.vXs,
                Text(
                  description!,
                  style: AppTextStyles.bodySmall,
                  maxLines: 2,
                  overflow: TextOverflow.ellipsis,
                ),
              ],
              AppSpacing.vSm,
              Wrap(
                spacing: 6,
                runSpacing: 6,
                children: [
                  if (riskLevel != null) FSBadge.risk(riskLevel!),
                  if (difficulty != null) FSBadge.difficulty(difficulty!),
                  if (eventType != null)
                    FSBadge(
                      text: eventType!,
                      variant: eventType!.toLowerCase() == 'major'
                          ? FSBadgeVariant.red
                          : FSBadgeVariant.blue,
                    ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}