import React from "react";
import { View, Text, TouchableOpacity, StyleSheet, StatusBar } from "react-native";
import { NativeStackScreenProps } from "@react-navigation/native-stack";
import { RootStackParamList } from "../App";

type Props = NativeStackScreenProps<RootStackParamList, "Home">;

export default function HomeScreen({ navigation }: Props) {
  return (
    <View style={styles.container}>
      {/* 设置状态栏颜色 */}
      <StatusBar backgroundColor="#E7141E" barStyle="light-content" />

      {/* 中间按钮 */}
      <View style={styles.centerBox}>
        <TouchableOpacity
          style={styles.button}
          onPress={() => navigation.navigate("Scan")}
        >
          <Text style={styles.buttonText}>搜索设备</Text>
        </TouchableOpacity>
      </View>

      {/* 底部区域 */}
      <View style={styles.bottomBox}>
        <TouchableOpacity onPress={() => navigation.navigate("Privacy")}>
          <Text style={styles.privacyText}>隐私协议</Text>
        </TouchableOpacity>
        <Text style={styles.version}>版本号 v0.0.1</Text>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
  },
  centerBox: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
  },
  button: {
    backgroundColor: "#E7141E", // 红色按钮
    paddingVertical: 15,
    paddingHorizontal: 40,
    borderRadius: 10,
  },
  buttonText: {
    color: "#fff",
    fontSize: 18,
    fontWeight: "bold",
  },
  bottomBox: {
    alignItems: "center",
    marginBottom: 20,
  },
  privacyText: {
    fontSize: 16,
    color: "#E7141E", // 红色字体
    marginBottom: 8,
  },
  version: {
    fontSize: 14,
    color: "#999",
  },
});
