import 'package:flutter/material.dart';

import 'package:asciineverdie/src/shared/retro_colors.dart';
import 'package:asciineverdie/src/shared/widgets/retro_widgets.dart';

/// 레트로 스타일 확인 다이얼로그
class RetroConfirmDialog extends StatelessWidget {
  const RetroConfirmDialog({
    super.key,
    required this.title,
    required this.message,
    required this.confirmText,
    required this.cancelText,
    required this.onConfirm,
    required this.onCancel,
  });

  final String title;
  final String message;
  final String confirmText;
  final String cancelText;
  final VoidCallback onConfirm;
  final VoidCallback onCancel;

  @override
  Widget build(BuildContext context) {
    final background = RetroColors.backgroundOf(context);
    final gold = RetroColors.goldOf(context);

    return Dialog(
      backgroundColor: Colors.transparent,
      child: Container(
        constraints: const BoxConstraints(maxWidth: 360),
        decoration: BoxDecoration(
          color: background,
          border: Border.all(color: gold, width: 3),
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            // 타이틀
            Container(
              width: double.infinity,
              padding: const EdgeInsets.all(12),
              color: gold.withValues(alpha: 0.2),
              child: Text(
                title,
                style: TextStyle(
                  fontFamily: 'PressStart2P',
                  fontSize: 10,
                  color: gold,
                ),
                textAlign: TextAlign.center,
              ),
            ),
            // 메시지
            Padding(
              padding: const EdgeInsets.all(16),
              child: Text(
                message,
                style: TextStyle(
                  fontFamily: 'PressStart2P',
                  fontSize: 16,
                  color: RetroColors.textPrimaryOf(context),
                  height: 1.8,
                ),
                textAlign: TextAlign.center,
              ),
            ),
            // 버튼
            Padding(
              padding: const EdgeInsets.fromLTRB(12, 0, 12, 12),
              child: Row(
                children: [
                  Expanded(
                    child: RetroTextButton(
                      text: cancelText,
                      isPrimary: false,
                      onPressed: onCancel,
                    ),
                  ),
                  const SizedBox(width: 8),
                  Expanded(
                    child: RetroTextButton(
                      text: confirmText,
                      onPressed: onConfirm,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
