import { createNativeStackNavigator } from '@react-navigation/native-stack';
import React from 'react';

import { DEFAULT_ROUTE_OPTIONS } from '../../../constants/settings';
import PersonDetailScreen from '../../../screens/personDetail/index';
import EducationDetailScreen from '../../../screens/profile/screens/education/screens/educationDetail/index';
import EducationOtherDetailScreen from '../../../screens/profile/screens/education/screens/educationDetail/screens/educationOtherDetail/index';
import EducationImageScreen from '../../../screens/profile/screens/education/screens/educationDetail/screens/educationOtherDetail/screens/educationImage/index';
import EducationStatusScreen from '../../../screens/profile/screens/education/screens/educationDetail/screens/educationStatus/index';
import SearchScreen from '../../../screens/search/index';
import SearchEducationScreen from '../../../screens/search/screens/searchEducation/index';
import SearchPersonScreen from '../../../screens/search/screens/searchPerson/index';
import SearchUnitScreen from '../../../screens/search/screens/searchUnit/index';
import UnitDetailScreen from '../../../screens/unit/screens/unitDetail/index';
import UnitFunctionsScreen from '../../../screens/unit/screens/unitFunctions/index';
import UnitInfoScreen from '../../../screens/unit/screens/unitInfo/index';
import UnitMembersScreen from '../../../screens/unit/screens/unitMembers/index';
import UnitRegistrationScreen from '../../../screens/unit/screens/unitRegistration/index';
import NavBar from '../../NavBar/NavBar';

export type SearchStackParamList = {
  SearchScreen: undefined;
  SearchPerson: undefined;
  SearchUnit: undefined;
  SearchEducation: undefined;
  PersonDetail: { id: string; isFromCatalog: boolean };
  UnitDetail: { id: string };
  UnitInfo: { id: string };
  UnitFunctions: { id: string };
  UnitMembers: { id: string };
  UnitRegistration: { id: string };
  EducationDetail: {
    id: string;
    educationName: string;
    logo: string;
    reminderId: string;
    educationCourseId: string;
  };
  EducationOtherDetail: {
    educationName: string;
    id: string;
  };
  EducationStatus: {
    id: string;
    educationName: string;
  };
  EducationImage: {
    imageName: string;
    imageContent: string;
  };
};

const SearchTab = createNativeStackNavigator<SearchStackParamList>();

const SearchStackScreen = () => (
  <SearchTab.Navigator screenOptions={DEFAULT_ROUTE_OPTIONS}>
    <SearchTab.Screen
      options={{
        headerTitle: () => {
          return <NavBar />;
        },
      }}
      name={'SearchScreen'}
      component={SearchScreen}
    />
    <SearchTab.Screen
      options={{
        headerTitle: 'Hledání osob',
      }}
      name={'SearchPerson'}
      component={SearchPersonScreen}
    />
    <SearchTab.Screen
      options={{
        headerTitle: 'Hledání jednotek',
      }}
      name={'SearchUnit'}
      component={SearchUnitScreen}
    />
    <SearchTab.Screen
      options={{
        headerTitle: 'Vzdělávací akce',
      }}
      name={'SearchEducation'}
      component={SearchEducationScreen}
    />
    <SearchTab.Screen
      options={{
        headerTitle: 'Detail osoby',
      }}
      name={'PersonDetail'}
      component={PersonDetailScreen}
    />
    <SearchTab.Screen name={'UnitDetail'} component={UnitDetailScreen} />
    <SearchTab.Screen name={'UnitInfo'} component={UnitInfoScreen} />
    <SearchTab.Screen name={'UnitFunctions'} component={UnitFunctionsScreen} />
    <SearchTab.Screen
      name={'UnitMembers'}
      options={{
        headerTitle: 'Členové jednotky',
      }}
      component={UnitMembersScreen}
    />

    <SearchTab.Screen
      name={'UnitRegistration'}
      options={{
        headerTitle: 'Statistika registrace',
      }}
      component={UnitRegistrationScreen}
    />
    <SearchTab.Screen name={'EducationDetail'} component={EducationDetailScreen} />
    <SearchTab.Screen name={'EducationOtherDetail'} component={EducationOtherDetailScreen} />
    <SearchTab.Screen name={'EducationStatus'} component={EducationStatusScreen} />
    <SearchTab.Screen name={'EducationImage'} component={EducationImageScreen} />
  </SearchTab.Navigator>
);

export default SearchStackScreen;
