import { useEffect, useState } from 'react';
import { useConnectionInterfaceConfig, useGeneratedConnections } from '../ConnectionInterface.js';
export function useRequiredConnectionOptions(connectionInterfaceType) {
    const [remote, setRemote] = useState([]);
    const [isLoading, setLoading] = useState(true);
    const connectionContext = useConnectionInterfaceConfig();
    const local = useGeneratedConnections(connectionInterfaceType ?? '');
    useEffect(() => {
        (async () => {
            const type = connectionInterfaceType ?? '';
            if (!type) {
                return setLoading(false);
            }
            try {
                setRemote(await connectionContext.getConnectionInterfaces(type));
            }
            catch (error) {
                // eslint-disable-next-line no-console
                console.error(error);
            }
            setLoading(false);
        })();
    }, []);
    return { remote, local, isLoading };
}
//# sourceMappingURL=use-required-connection-options.js.map