import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';
import type { Component } from 'solid-js';

import { AuthProvider } from './lib/auth';
import { LiveEventsProvider } from './lib/live-events';
import { AppSettingsProvider } from './lib/settings';
import { AppRoutes } from './routes';

const queryClient = new QueryClient({
	defaultOptions: {
		queries: {
			retry: 1,
			staleTime: 30_000,
		},
	},
});

const App: Component = () => (
	<QueryClientProvider client={queryClient}>
		<AppSettingsProvider>
			<AuthProvider>
				<LiveEventsProvider>
					<AppRoutes />
				</LiveEventsProvider>
			</AuthProvider>
		</AppSettingsProvider>
	</QueryClientProvider>
);

export default App;
