import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';
import { CheckCircle, XCircle, AlertCircle } from 'lucide-react';

interface ActionStatusModalProps {
  open: boolean;
  onClose: () => void;
  success: boolean;
  title?: string;
  message?: string;
}

export function ActionStatusModal({ 
  open, 
  onClose, 
  success,
  title,
  message 
}: ActionStatusModalProps) {
  return (
    <Dialog open={open} onOpenChange={onClose}>
      <DialogContent className="sm:max-w-md">
        <DialogHeader>
          <DialogTitle className="flex items-center gap-2">
            {success ? (
              <CheckCircle className="w-5 h-5 text-green-600" />
            ) : (
              <AlertCircle className="w-5 h-5 text-red-600" />
            )}
            {title || (success ? 'Success' : 'Error')}
          </DialogTitle>
        </DialogHeader>
        
        <div className="py-6">
          <div className="flex flex-col items-center text-center">
            {success ? (
              <>
                <div className="w-16 h-16 rounded-full bg-green-100 flex items-center justify-center mb-4">
                  <CheckCircle className="w-8 h-8 text-green-600" />
                </div>
                <p className="text-sm text-gray-700">
                  {message || 'Operation completed successfully!'}
                </p>
              </>
            ) : (
              <>
                <div className="w-16 h-16 rounded-full bg-red-100 flex items-center justify-center mb-4">
                  <XCircle className="w-8 h-8 text-red-600" />
                </div>
                <p className="text-sm text-gray-700">
                  {message || 'Operation failed. Please try again.'}
                </p>
              </>
            )}
          </div>
        </div>
        
        <DialogFooter>
          <Button 
            onClick={onClose} 
            className={`w-full ${success ? 'bg-green-600 hover:bg-green-700' : 'bg-gray-600 hover:bg-gray-700'}`}
          >
            OK
          </Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
}

