import { queryClient } from '../commands/_app.js';
import { findSolidityFiles } from '../util/forge/findSolidityFiles.js';
import { getSrcDir } from '../util/forge/foundryProject.js';
import { useQuery } from '@tanstack/react-query';
const getQueryParams = (foundryProjectPath) => {
    return {
        queryKey: ['listFoundryProjectSolidityFiles', foundryProjectPath],
        queryFn: () => findSolidityFiles(getSrcDir(foundryProjectPath)),
    };
};
export const queryFoundryProjectSolidityFiles = async (foundryProjectPath) => {
    return queryClient.fetchQuery(getQueryParams(foundryProjectPath));
};
export const useFoundryProjectSolidityFiles = (foundryProjectPath) => {
    return useQuery({
        ...getQueryParams(foundryProjectPath),
        staleTime: Infinity, // For the duration of the CLI session, we want to use the cached artifact
    });
};
