import { Button, Group, Modal, Text } from "@mantine/core";

interface AlertModalProps {
  opened: boolean;
  onClose: () => void;
  title?: string;
  message: string;
  color?: string;
}

export default function AlertModal({
  opened,
  onClose,
  title = "Error",
  message,
  color = "red",
}: AlertModalProps) {
  return (
    <Modal opened={opened} onClose={onClose} title={<Text fw={600} c={color}>{title}</Text>} centered>
      <Text size="sm" mb="lg">
        {message}
      </Text>
      <Group justify="flex-end">
        <Button onClick={onClose}>OK</Button>
      </Group>
    </Modal>
  );
}
