import { ModalsManagerProvider } from "@/contexts/ModalsManagerContext";
import { UserAuthenticationContextProvider } from "@/contexts/UserAuthenticationContext";
import { AppMainStackNavigatorAuthWrapper } from "@/navigations/AppMainStackNavigator";
import theme from "@/themes/Theme";
import ProvideQueryClient from "@components/providers_wrappers/ProvideQueryClient";
import { LOG } from "@logger";
import { NavigationContainer } from "@react-navigation/native";
import { ThemeProvider } from "@shopify/restyle";
import ModalContainer from "react-modal-promise";
import { SafeAreaProvider } from "react-native-safe-area-context";

import "react-native-gesture-handler";
import "react-native-reanimated";

const log = LOG.extend("App");

export default function App() {
	log.verbose("App started...");
	return (
		<ThemeProvider theme={theme}>
			<ModalsManagerProvider>
				<SafeAreaProvider>
					<ProvideQueryClient>
						<UserAuthenticationContextProvider>
							<NavigationContainer>
								<AppMainStackNavigatorAuthWrapper />
							</NavigationContainer>
						</UserAuthenticationContextProvider>
					</ProvideQueryClient>
				</SafeAreaProvider>
			</ModalsManagerProvider>
			<ModalContainer />
		</ThemeProvider>
	);
}
