import { useState } from "react";
import BaseFormInputProps from "@/utils/baseFormInputProps";

type Props = {
    imageUrlInputProps?: BaseFormInputProps<string>;
};

const useImageDropzone = ({ imageUrlInputProps }: Props) => {
    const [showDropzone, setShowDropzone] = useState(
        !(
            typeof imageUrlInputProps?.value === "string" &&
            imageUrlInputProps.value.trim() !== ""
        )
    );

    const [isLoading, setIsLoading] = useState(false);

    return {
        showDropzone,
        setShowDropzone,
        isLoading,
        setIsLoading,
        imageUrlInputProps,
    };
};

export default useImageDropzone;
