import React from "react";
import { createStackNavigator } from "@react-navigation/stack";

import { Palette } from "../styles";
import { Routes } from "./Routes";

import { BottomTabScreen } from "./BottomTab";

import Splash from "../screens/Splash";
import Onboarding from "../screens/Onboarding";
import Login from "../screens/Login";
import ForgotPassword from "../screens/ForgotPassword";

import Notifications from "../screens/Profile/Notifications";

import TermsOfUse from "../screens/TermsOfUse";
import PrivacyPolicy from "../screens/PrivacyPolicy";
import Writing from "../screens/Writing/Writing";
import WritingLyrics from "../screens/Writing/WritingLyrics";
import CreateLyricsWithAi from "../screens/Writing/CreateLyricsWithAi";
import Lyrics from "../screens/Writing/Lyrics";
import FinishedWriting from "../screens/Writing/FinishedWriting";
import Studio from "../screens/Studio/Studio";
import ComposeSong from "../screens/Studio/ComposeSong";
import Compose from "../screens/Studio/Compose";
import CustomizeVoice from "../screens/Studio/CustomizeVoice";
import SongReady from "../screens/Studio/SongReady";
import Regenerate from "../screens/Studio/Regenerate";
import PouchReady from "../screens/Studio/PouchReady";
import PhotoCover from "../screens/Studio/PhotoCover";
import AddPhotoCover from "../screens/Studio/AddPhotoCover";
import FinishCompose from "../screens/Studio/FinishCompose";
import Production from "../screens/Production/Production";
import ProductionOnboarding from "../screens/Production/ProductionOnboarding";
import DownloadSongs from "../screens/Production/DownloadSongs";
import DownloadPrices from "../screens/Production/DownloadPrices";
import SongDownloaded from "../screens/Production/SongDownloaded";
import StreamSong from "../screens/Production/StreamSong";
import SongRelease from "../screens/Production/SongRelease";
import PlaybackExample from "../screens/Production/PlaybackExample";
import PlaybackOnboarding from "../screens/Playback/PlaybackOnboarding";
import Playback from "../screens/Playback/Playback";
import RecordPlayback from "../screens/Playback/RecordPlayback";
import RecordedPlayback from "../screens/Playback/RecordedPlayback";
import ChooseDecor from "../screens/Playback/ChooseDecor";
import CreatingDecor from "../screens/Playback/CreatingDecor";
import VideoFinalize from "../screens/Playback/VideoFinalize";
import GeneratingSong from "../screens/Studio/GeneratingSong";
import AllMyMusic from "../screens/Library/AllMyMusic";
import AllMyPlaylist from "../screens/Library/AllMyPlaylist";
import AllMyLikedMusic from "../screens/Library/AllMyLikedMusic";
import Research from "../screens/Library/Research";
import MusicDetails from "../screens/Library/MusicDetails";
import PlaylistDetails from "../screens/Library/PlaylistDetails";
import Profile from "../screens/Profile/Profile";
import EditProfile from "../screens/Profile/EditProfile";
import Settings from "../screens/Profile/Settings";
import ChangeEmailAddress from "../screens/Profile/ChangeEmailAddress";
import ChangePassword from "../screens/Profile/ChangePassword";
import Language from "../screens/Profile/Language";
import Reels from "../screens/Profile/Reels";
import Follows from "../screens/Profile/Follows";
import NewMusicOptions from "../screens/NewMusicOptions";
import Register from "../screens/Register";
import CreatePassword from "../screens/CreatePassword";
import CreatePseudo from "../screens/CreatePseudo";

const screenOptions = {
  headerShown: false,
  cardOverlayEnabled: true,
  headerStyle: {
    backgroundColor: Palette.background,
  },
  headerTitleStyle: {},
  headerTitleAlign: "center",
  headerBackTitleVisible: false,
};

const MainStack = createStackNavigator();

const screens = [
  { name: Routes.Splash, component: Splash },
  { name: Routes.Onboarding, component: Onboarding },
  { name: Routes.Login, component: Login, title: "Connexion" },
  {
    name: Routes.ForgotPassword,
    component: ForgotPassword,
    title: "Mot de passe oublié",
  },
  {
    name: Routes.BottomTab,
    component: BottomTabScreen,
    options: { animationEnabled: false },
  },
  {
    name: Routes.TermsOfUse,
    component: TermsOfUse,
    title: "Conditions d'utilisation",
  },
  {
    name: Routes.PrivacyPolicy,
    component: PrivacyPolicy,
    title: "Politique de confidentialité",
  },
  {
    name: Routes.Writing,
    component: Writing,
  },
  {
    name: Routes.WritingLyrics,
    component: WritingLyrics,
  },
  {
    name: Routes.CreateLyricsWithAi,
    component: CreateLyricsWithAi,
  },
  {
    name: Routes.Lyrics,
    component: Lyrics,
  },
  {
    name: Routes.FinishedWriting,
    component: FinishedWriting,
  },
  {
    name: Routes.Studio,
    component: Studio,
  },
  {
    name: Routes.ComposeSong,
    component: ComposeSong,
  },
  {
    name: Routes.Compose,
    component: Compose,
  },
  {
    name: Routes.CustomizeVoice,
    component: CustomizeVoice,
  },
  {
    name: Routes.SongReady,
    component: SongReady,
  },
  {
    name: Routes.Regenerate,
    component: Regenerate,
  },
  {
    name: Routes.PouchReady,
    component: PouchReady,
  },
  {
    name: Routes.PhotoCover,
    component: PhotoCover,
  },
  {
    name: Routes.AddPhotoCover,
    component: AddPhotoCover,
  },
  {
    name: Routes.FinishCompose,
    component: FinishCompose,
  },
  {
    name: Routes.ProductionOnboarding,
    component: ProductionOnboarding,
  },
  {
    name: Routes.Production,
    component: Production,
  },
  {
    name: Routes.DownloadSongs,
    component: DownloadSongs,
  },
  {
    name: Routes.DownloadPrices,
    component: DownloadPrices,
  },
  {
    name: Routes.SongDownloaded,
    component: SongDownloaded,
  },
  {
    name: Routes.StreamSong,
    component: StreamSong,
  },
  {
    name: Routes.GeneratingSong,
    component: GeneratingSong,
  },
  {
    name: Routes.SongRelease,
    component: SongRelease,
  },
  {
    name: Routes.PlaybackExample,
    component: PlaybackExample,
  },
  {
    name: Routes.PlaybackOnboarding,
    component: PlaybackOnboarding,
  },
  {
    name: Routes.Playback,
    component: Playback,
  },
  {
    name: Routes.RecordPlayback,
    component: RecordPlayback,
  },
  {
    name: Routes.RecordedPlayback,
    component: RecordedPlayback,
  },
  {
    name: Routes.ChooseDecor,
    component: ChooseDecor,
  },
  {
    name: Routes.CreatingDecor,
    component: CreatingDecor,
  },
  {
    name: Routes.VideoFinalize,
    component: VideoFinalize,
  },
  {
    name: Routes.AllMyMusic,
    component: AllMyMusic,
  },
  {
    name: Routes.AllMyPlaylist,
    component: AllMyPlaylist,
  },
  {
    name: Routes.PlaylistDetails,
    component: PlaylistDetails,
  },
  {
    name: Routes.AllMyLikedMusic,
    component: AllMyLikedMusic,
  },
  {
    name: Routes.Research,
    component: Research,
  },
  {
    name: Routes.MusicDetails,
    component: MusicDetails,
  },
  {
    name: Routes.SingerProfile,
    component: Profile,
  },
  {
    name: Routes.EditProfile,
    component: EditProfile,
  },
  {
    name: Routes.Settings,
    component: Settings,
  },
  {
    name: Routes.Follows,
    component: Follows,
  },
  {
    name: Routes.FlowSelection,
    component: NewMusicOptions,
  },
  {
    name: Routes.ChangeEmailAddress,
    component: ChangeEmailAddress,
  },
  {
    name: Routes.ChangePassword,
    component: ChangePassword,
  },
  {
    name: Routes.Notifications,
    component: Notifications,
  },
  {
    name: Routes.Language,
    component: Language,
  },
  {
    name: Routes.Reels,
    component: Reels,
  },
  {
    name: Routes.Register,
    component: Register,
  },
  {
    name: Routes.CreatePassword,
    component: CreatePassword,
  },
  {
    name: Routes.CreatePseudo,
    component: CreatePseudo,
  },
];

export default function Main() {
  return (
    <MainStack.Navigator
      initialRouteName={Routes.Splash}
      screenOptions={[
        {
          contentStyle: {
            backgroundColor: Palette.white,
          },
        },
        screenOptions,
      ]}
    >
      {screens.map((screen) => (
        <MainStack.Screen
          key={screen.name}
          name={screen.name}
          component={screen.component}
          title={screen.title}
          options={{ headerShown: false, ...screen.options }}
        />
      ))}
    </MainStack.Navigator>
  );
}
