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 UnitScreen from '../../../screens/unit/index';
import CampsScreen from '../../../screens/unit/screens/camps/index';
import CampDetailScreen from '../../../screens/unit/screens/camps/screens/campDetail/index';
import CampParticipantsScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/CampParticipants/index';
import CampParticipantAddNewScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/CampParticipants/screens/campParticipantAddNew/index';
import CampParticipantAddSearchScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/CampParticipants/screens/campParticipantAddSearch/index';
import CampParticipantAddUnitScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/CampParticipants/screens/campParticipantAddUnit/index';
import CampParticipantEditScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/CampParticipants/screens/campParticipantEdit/index';
import CampParticipantsStatsScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/CampParticipants/screens/campParticipantsStats/index';
import CampStateScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/campState/index';
import CampTeamScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/campTeam/index';
import CampTeamEditScreen from '../../../screens/unit/screens/camps/screens/campDetail/screens/campTeam/screens/campTeamEdit/index';
import CampEditScreen from '../../../screens/unit/screens/camps/screens/campEdit/index';
import EventsScreen from '../../../screens/unit/screens/events/index';
import EventDetailScreen from '../../../screens/unit/screens/events/screens/eventDetail/index';
import EventMessageScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventMessage/index';
import EventMessageEditScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventMessage/screens/eventMessageEdit/index';
import EventParticipantsScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventParticipants/index';
import EventParticipantAddNewScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventParticipants/screens/eventParticipantAddNew/index';
import EventParticipantAddSearchScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventParticipants/screens/eventParticipantAddSearch/index';
import EventParticipantEditScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventParticipants/screens/eventParticipantEdit/index';
import EventParticipantsStatsScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventParticipants/screens/eventParticipantsStats/index';
import EventStateScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventState/index';
import EventTeamScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventTeam/index';
import EventTeamEditScreen from '../../../screens/unit/screens/events/screens/eventDetail/screens/eventTeam/screens/eventTeamEdit/index';
import EventEditScreen from '../../../screens/unit/screens/events/screens/eventEdit';
import TemplatesScreen from '../../../screens/unit/screens/templates/index';
import TemplateDetailScreen from '../../../screens/unit/screens/templates/screens/templateDetail';
import UnitAdvertisingScreen from '../../../screens/unit/screens/unitAdvertising/index';
import UnitAdvertisingCategoryScreen from '../../../screens/unit/screens/unitAdvertising/screens/unitAdvertisingCategory/index';
import UnitAdvertisingCategoryEditScreen from '../../../screens/unit/screens/unitAdvertising/screens/unitAdvertisingCategoryEdit/index';
import UnitAdvertisingMeetingDateScreen from '../../../screens/unit/screens/unitAdvertising/screens/unitAdvertisingMeetingDate/index';
import UnitAdvertisingMeetingDateEditScreen from '../../../screens/unit/screens/unitAdvertising/screens/unitAdvertisingMeetingDateEdit/index';
import UnitAdvertisingNoteEditScreen from '../../../screens/unit/screens/unitAdvertising/screens/unitAdvertisingNoteEdit/index';
import UnitApplicationScreen from '../../../screens/unit/screens/unitApplication/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 UnitStackParamList = {
  UnitScreen: undefined;
  UnitInfo: { id: string };
  UnitDetail: { id: string };
  UnitFunctions: { id: string };
  UnitMembers: { id: string };
  UnitRegistration: { id: string };
  UnitAdvertising: undefined;
  UnitAdvertisingNoteEdit: undefined;
  UnitAdvertisingCategory: { id: string };
  UnitAdvertisingCategoryEdit: { id?: string };
  UnitAdvertisingMeetingDate: { id: string };
  UnitAdvertisingMeetingDateEdit: { id?: string };
  UnitApplication: undefined;
  PersonDetail: { id: string; isFromCatalog: boolean };
  Camps: undefined;
  CampEdit: {
    id?: string;
    filterName?: string;
    filterIsFuture?: boolean;
    filterYear?: string;
    filterRelationValue?: string;
    filterRegNumber?: string;
    filterLocation?: string;
  };
  CampDetail: {
    id: string;
    isRelation: boolean;
    campName: string;
    filterName?: string;
    filterIsFuture?: boolean;
    filterYear?: string;
    filterRelationValue?: string;
    filterRegNumber?: string;
    filterLocation?: string;
  };
  CampParticipants: { id: string; campName: string; isRelation: boolean };
  CampParticipantsStats: { id: string; campName: string };
  CampParticipantEdit: {
    id: string;
    campId: string;
    personName: string;
    isEstimate: boolean;
    isReal: boolean;
    days?: string;
    note?: string;
  };
  CampParticipantAddNew: { campId: string };
  CampParticipantAddSearch: { campId: string };
  CampParticipantAddUnit: { campId: string };
  CampState: { id: string; campName: string; isRelation: boolean };
  CampTeam: { id: string; campName: string; isRelation: boolean };
  CampTeamEdit: { id?: string; name?: string; note?: string; role: string; campId: string };
  Events: undefined;
  EventDetail: {
    id: string;
    isRelation: boolean;
    eventName: string;
    filterIsFuture?: boolean;
    filterYear?: string;
    filterRelationValue?: string;
    filterTypeId?: string;
    filterStateId?: string;
    filterScopeId?: string;
    filterLocation?: string;
  };
  EventEdit: {
    id?: string;
    filterIsFuture?: boolean;
    filterYear?: string;
    filterRelationValue?: string;
    filterTypeId?: string;
    filterStateId?: string;
    filterScopeId?: string;
    filterLocation?: string;
  };
  EventTeam: { id: string; eventName: string; isRelation: boolean };
  EventTeamEdit: { id?: string; name?: string; note?: string; role: string; eventId: string };
  EventParticipants: { id: string; eventName: string; isRelation: boolean };
  EventParticipantEdit: {
    id: string;
    eventId: string;
    personName: string;
    days?: string;
    note?: string;
  };
  EventParticipantAddNew: { eventId: string };
  EventParticipantAddSearch: { eventId: string };
  EventParticipantsStats: { id: string; eventName: string; hasAccess?: boolean };
  EventState: { id: string; eventName: string; isRelation: boolean };
  EventMessage: { id: string; eventName: string; isRelation: boolean };
  EventMessageEdit: { id: string };
  Templates: undefined;
  TemplateDetail: { id: string; templateName: string };
};

const UnitTab = createNativeStackNavigator<UnitStackParamList>();

const UnitStackScreen = () => (
  <UnitTab.Navigator screenOptions={DEFAULT_ROUTE_OPTIONS}>
    <UnitTab.Screen
      options={{
        headerTitle: () => {
          return <NavBar />;
        },
      }}
      name={'UnitScreen'}
      component={UnitScreen}
    />
    <UnitTab.Screen name={'UnitDetail'} component={UnitDetailScreen} />
    <UnitTab.Screen name={'UnitInfo'} component={UnitInfoScreen} />
    <UnitTab.Screen name={'UnitFunctions'} component={UnitFunctionsScreen} />
    <UnitTab.Screen
      name={'UnitMembers'}
      options={{
        headerTitle: 'Členové jednotky',
      }}
      component={UnitMembersScreen}
    />

    <UnitTab.Screen
      name={'UnitRegistration'}
      options={{
        headerTitle: 'Statistika registrace',
      }}
      component={UnitRegistrationScreen}
    />

    <UnitTab.Screen
      name={'UnitAdvertising'}
      options={{
        headerTitle: 'Informace k náborům',
      }}
      component={UnitAdvertisingScreen}
    />

    <UnitTab.Screen
      name={'UnitAdvertisingNoteEdit'}
      options={{
        headerTitle: 'Upravit poznámku',
      }}
      component={UnitAdvertisingNoteEditScreen}
    />

    <UnitTab.Screen
      name={'UnitAdvertisingCategory'}
      options={{
        headerTitle: 'Detail kategorie',
      }}
      component={UnitAdvertisingCategoryScreen}
    />

    <UnitTab.Screen
      name={'UnitAdvertisingCategoryEdit'}
      component={UnitAdvertisingCategoryEditScreen}
    />

    <UnitTab.Screen
      name={'UnitAdvertisingMeetingDateEdit'}
      component={UnitAdvertisingMeetingDateEditScreen}
    />

    <UnitTab.Screen
      name={'UnitAdvertisingMeetingDate'}
      options={{
        headerTitle: 'Detail schůzek',
      }}
      component={UnitAdvertisingMeetingDateScreen}
    />

    <UnitTab.Screen
      options={{
        headerTitle: 'Odeslání e-přihlášky',
      }}
      name={'UnitApplication'}
      component={UnitApplicationScreen}
    />

    <UnitTab.Screen
      options={{
        headerTitle: 'Detail osoby',
      }}
      name={'PersonDetail'}
      component={PersonDetailScreen}
    />
    <UnitTab.Screen
      options={{
        headerTitle: 'Tábory',
      }}
      name={'Camps'}
      component={CampsScreen}
    />
    <UnitTab.Screen name="CampEdit" component={CampEditScreen} />
    <UnitTab.Screen name="CampDetail" component={CampDetailScreen} />
    <UnitTab.Screen name="CampParticipants" component={CampParticipantsScreen} />
    <UnitTab.Screen name="CampParticipantsStats" component={CampParticipantsStatsScreen} />
    <UnitTab.Screen
      options={{
        headerTitle: 'Přidat účastníka',
      }}
      name="CampParticipantAddNew"
      component={CampParticipantAddNewScreen}
    />
    <UnitTab.Screen
      options={{
        headerTitle: 'Přidat účastníka',
      }}
      name="CampParticipantAddSearch"
      component={CampParticipantAddSearchScreen}
    />
    <UnitTab.Screen
      options={{
        headerTitle: 'Přidat výběrem z oddílu',
      }}
      name="CampParticipantAddUnit"
      component={CampParticipantAddUnitScreen}
    />
    <UnitTab.Screen
      options={{
        headerTitle: 'Upravit účastníka',
      }}
      name="CampParticipantEdit"
      component={CampParticipantEditScreen}
    />
    <UnitTab.Screen name="CampState" component={CampStateScreen} />
    <UnitTab.Screen name="CampTeam" component={CampTeamScreen} />
    <UnitTab.Screen name="CampTeamEdit" component={CampTeamEditScreen} />
    <UnitTab.Screen
      options={{
        headerTitle: 'Obecné akce',
      }}
      name={'Events'}
      component={EventsScreen}
    />
    <UnitTab.Screen name="EventDetail" component={EventDetailScreen} />
    <UnitTab.Screen name="EventEdit" component={EventEditScreen} />
    <UnitTab.Screen name="EventTeam" component={EventTeamScreen} />
    <UnitTab.Screen name="EventTeamEdit" component={EventTeamEditScreen} />
    <UnitTab.Screen name="EventParticipantsStats" component={EventParticipantsStatsScreen} />
    <UnitTab.Screen name="EventParticipants" component={EventParticipantsScreen} />
    <UnitTab.Screen
      options={{
        headerTitle: 'Přidat účastníka',
      }}
      name="EventParticipantAddNew"
      component={EventParticipantAddNewScreen}
    />
    <UnitTab.Screen
      options={{
        headerTitle: 'Přidat účastníka',
      }}
      name="EventParticipantAddSearch"
      component={EventParticipantAddSearchScreen}
    />
    <UnitTab.Screen
      options={{
        headerTitle: 'Upravit účastníka',
      }}
      name="EventParticipantEdit"
      component={EventParticipantEditScreen}
    />
    <UnitTab.Screen name="EventState" component={EventStateScreen} />
    <UnitTab.Screen name="EventMessage" component={EventMessageScreen} />
    <UnitTab.Screen
      name="EventMessageEdit"
      options={{
        headerTitle: 'Upravit zprávu',
      }}
      component={EventMessageEditScreen}
    />
    <UnitTab.Screen
      name="Templates"
      options={{
        headerTitle: 'Exporty',
      }}
      component={TemplatesScreen}
    />
    <UnitTab.Screen name="TemplateDetail" component={TemplateDetailScreen} />
  </UnitTab.Navigator>
);

export default UnitStackScreen;
