import 'package:flutter/material.dart';
import 'validation_modal_theme.dart';

/// Affiche une confirmation avant d’appeler l’API de validation du dossier.
/// Retourne `true` si l’utilisateur confirme.
Future<bool> showValidationValiderConfirmDialog(
  BuildContext context, {
  required String body,
}) async {
  final result = await showDialog<bool>(
    context: context,
    barrierDismissible: false,
    builder: (dialogContext) {
      return AlertDialog(
        title: const Text('Confirmer la validation'),
        content: Text(body),
        actions: [
          TextButton(
            onPressed: () => Navigator.of(dialogContext).pop(false),
            child: const Text('Annuler'),
          ),
          ElevatedButton(
            style: ValidationModalTheme.primaryElevatedStyle,
            onPressed: () => Navigator.of(dialogContext).pop(true),
            child: const Text('Confirmer'),
          ),
        ],
      );
    },
  );
  return result == true;
}
