import React from 'react';
import {NativeStackNavigationOptions} from '@react-navigation/native-stack';
import {RootStack} from '@navigation/RootStack';
import {AMPLITUDE_APP_MODULES, Screens} from '@shared/constants';

import {ChatMessageInfo} from '../screens/ChatMessageInfo';
import {ChatHomeScreen} from '../screens/ChatHome';
import {ChatMessagesScreen} from '../screens/ChatMessages';
import {ChatNewScreen} from '../screens/ChatNew';
import {ChatNewGroupName} from '../screens/ChatNewGroupName';
import {ImageViewer} from '../screens/ImageViewer';
import CameraScreen from '../screens/Camera';
import {ChatInfoScreen} from '../screens/ChatInfo';

const SCREEN_OPTIONS = {
  module: AMPLITUDE_APP_MODULES.Chats2,
  headerShown: false,
  freezeOnBlur: true,
} as NativeStackNavigationOptions;

export const ChatsScreens = (
  <RootStack.Group key="chats" screenOptions={SCREEN_OPTIONS}>
    <RootStack.Screen
      name={Screens.CHATS_HOME}
      component={ChatHomeScreen}
      options={{freezeOnBlur: false}}
    />
    <RootStack.Screen
      name={Screens.CHAT_MESSAGES}
      component={ChatMessagesScreen}
      options={{
        // NOTE(terrysahaidak): produces weird bugs with keyboard when enabled
        // attempted to fix in native but could not find solution
        // iOS freezes the keyboard in place on swiping back
        keyboardHandlingEnabled: false,
        animation: 'default',
      }}
    />
    <RootStack.Screen
      name={Screens.NEW_CAMERA}
      component={CameraScreen}
      options={{gestureEnabled: false}}
    />
    <RootStack.Screen
      name={Screens.CHATS_NEW}
      component={ChatNewScreen}
      options={{gestureEnabled: false, presentation: 'containedModal'}}
    />
    <RootStack.Screen
      name={Screens.CHATS_NEW_GROUP}
      component={ChatNewScreen}
      options={{gestureEnabled: false, presentation: 'containedModal'}}
    />
    <RootStack.Screen
      name={Screens.CHATS_NEW_GROUP_NAME}
      component={ChatNewGroupName}
      options={{
        presentation: 'containedModal',
      }}
    />
    <RootStack.Screen
      name={Screens.CHATS_IMAGE_VIEWER}
      component={ImageViewer}
    />
    <RootStack.Screen
      name={Screens.CHAT_MESSAGE_INFO}
      component={ChatMessageInfo}
    />
    <RootStack.Screen
      name={Screens.CHATS_CHAT_INFO}
      component={ChatInfoScreen}
    />
  </RootStack.Group>
);

export * from './utils';
