/**
 * On-ramp provider registry — discovers available providers and selects defaults.
 *
 * Currently Transak-only. Coinbase and Ramp Network disabled.
 */

import type { OnrampProvider, OnrampProviderId } from './onramp-provider';
import { TransakOnrampAdapter } from './transak-onramp';

const providers: OnrampProvider[] = [
	new TransakOnrampAdapter(),
];

export function getAvailableProviders(): { id: OnrampProviderId; name: string }[] {
	return providers
		.filter((p) => p.isAvailable())
		.map((p) => ({ id: p.id, name: p.name }));
}

export function getProvider(id: OnrampProviderId): OnrampProvider | null {
	const p = providers.find((p) => p.id === id);
	return p && p.isAvailable() ? p : null;
}

export function getDefaultProvider(): OnrampProvider | null {
	return providers.find((p) => p.isAvailable()) || null;
}
