import React, { useEffect } from 'react';
import { Box, Text } from 'ink';

interface SuccessDisplayProps {
  message: string;
  onDismiss: () => void;
}

export function SuccessDisplay({ message, onDismiss }: SuccessDisplayProps) {
  useEffect(() => {
    const timer = setTimeout(onDismiss, 3000);
    return () => clearTimeout(timer);
  }, [onDismiss]);

  return (
    <Box flexDirection="column" borderStyle="round" borderColor="green" paddingX={1}>
      <Text color="green" bold>
        Erfolg
      </Text>
      <Text color="green">{message}</Text>
      <Text color="gray" dimColor>
        [Enter] Schließen (auto-dismiss nach 3 s)
      </Text>
    </Box>
  );
}
