import { useQuery, useQueryClient } from '@tanstack/react-query';
import { useSeamClient } from '../../../../lib/seam/use-seam-client.js';
export function useManufacturers(params) {
    const { client: seam } = useSeamClient();
    const queryClient = useQueryClient();
    const { data, ...rest } = useQuery({
        enabled: seam != null,
        queryKey: ['internal', 'manufacturers', 'list', params],
        queryFn: async () => {
            if (seam == null)
                return [];
            const { data: { manufacturers }, } = await seam.client.get('/internal/devicedb/v1/manufacturers/list', { params });
            for (const manufacturer of manufacturers) {
                queryClient.setQueryData([
                    'internal',
                    'manufacturers',
                    'get',
                    { manufacturer_id: manufacturer.manufacturer_id },
                ], manufacturer);
            }
            return manufacturers;
        },
    });
    return { ...rest, manufacturers: data };
}
//# sourceMappingURL=use-manufacturers.js.map