import * as React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";

import HomeScreen from "./src/HomeScreen";
import ScanScreen from "./src/ScanScreen";
import InfoScreen from "./src/InfoScreen";
import DfuScreen from "./src/DfuScreen";
import PrivacyScreen from "./src/PrivacyScreen";
import SplashScreen from "./src/SplashScreen"; // ✅ 新增启动页
import pxToDp from "./src/helper/pxToDp";
import SettingScreen from "./src/SettingScreen";
import './src/i18n'

export type RootStackParamList = {
  Splash: undefined;
  Home: undefined;
  Scan: undefined;
  Info: { peripheral: any };
  Dfu: { deviceId: string; name: string; firmware: string };
  Privacy: undefined;
  Setting: undefined;
};

const Stack = createNativeStackNavigator<RootStackParamList>();

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator
        initialRouteName="Splash"
        screenOptions={{
          animation : 'slide_from_right'
        }}>
        {/* 启动页（无标题） */}
        <Stack.Screen
          name="Splash"
          component={SplashScreen}
          options={{ headerShown: false }}
        />

        {/* 首页(标题栏无文字) */}
        <Stack.Screen
          name="Home"
          component={HomeScreen}
          options={{ headerShown: false }}
        />

        {/* 其他页面默认显示标题栏 */}
        <Stack.Screen
          name="Scan"
          component={ScanScreen}
          // options={{ title: "搜索设备" }}
          options={{ headerShown: false }}
        />
        <Stack.Screen
          name="Info"
          component={InfoScreen}
          // options={{ title: "设备详情" }}
          options={{ headerShown: false }}
        />
        <Stack.Screen
          name="Dfu"
          component={DfuScreen}
          // options={{ title: "固件升级" }}
          options={{ headerShown: false }}
        />
        <Stack.Screen
          name="Privacy"
          component={PrivacyScreen}
          // options={{ title: "隐私协议" }}
          options={{ headerShown: false }}
        />
        <Stack.Screen
          name="Setting"
          component={SettingScreen}
          // options={{ title: "隐私协议" }}
          options={{ headerShown: false }}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
}
