import { useQuery } from "@tanstack/react-query";
import { getStatusHistoryOptions } from "@/lib/client/@tanstack/react-query.gen";

type Props = {
    dealId: number;
};

const useStatusHistoryList = ({ dealId }: Props) => {
    const options = {
        path: { dealId },
    };
    const { data, refetch } = useQuery(getStatusHistoryOptions(options));

    return {
        history: data?.items ?? [],
        refetch,
    };
};

export default useStatusHistoryList;
