import { View, Text } from "react-native";
import { IconButton } from "react-native-paper";

import { LoadingSpinner } from "@/components/ui/LoadingSpinner";
import { Button } from "@/components/ui/Button";

interface NoDataProps {
  onRetry: () => void;
  message: string;
  isRetrying: boolean;
}

export const NoData = ({ onRetry, message, isRetrying }: NoDataProps) => {
  return (
    <View className="flex-1 items-center justify-center py-6">
      <IconButton iconColor="#F83434" icon="alert-circle-outline" size={48} />
      <Text className="text-center text-base font-medium mb-2">{message}</Text>
      <Text className="text-center text-sm mb-4">
        Please try again or contact support if the problem persists.
      </Text>
      {isRetrying ? (
        <LoadingSpinner />
      ) : (
        <Button onPress={onRetry} disabled={isRetrying}>
          Retry
        </Button>
      )}
    </View>
  );
};
