import * as Application from 'expo-application';
import { Link } from 'expo-router';
import { Pressable, StyleSheet, Text, View } from 'react-native';

// Phase 0 landing screen. Just enough to prove the app boots and routes:
//   * Netralax brand wordmark (replaces the previous "ChatApp" string).
//   * Runtime version from expo-application so we can spot stale builds
//     on a TestFlight tester's device at a glance.
//   * Placeholder nav link into (app)/chats — exercises Expo Router so a
//     routing regression shows up here instead of mid-Phase-1.
//
// Phase 1 replaces this with the actual magic-link login form.
export default function Landing() {
  const version = Application.nativeApplicationVersion ?? '0.0.0';

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Netralax</Text>
      <Text style={styles.subtitle}>Phase 0 — Deployment-Fundament</Text>
      <Text style={styles.version}>v{version}</Text>

      <Link href="/(app)/chats" asChild>
        <Pressable style={styles.button}>
          <Text style={styles.buttonText}>Weiter (Smoke-Test)</Text>
        </Pressable>
      </Link>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#0b0b0f',
    padding: 24,
  },
  title: { color: '#fff', fontSize: 32, fontWeight: '700', letterSpacing: 1 },
  subtitle: { color: '#9ca3af', marginTop: 8, marginBottom: 4 },
  version: { color: '#6b7280', fontSize: 12, marginBottom: 32 },
  button: {
    backgroundColor: '#5865f2',
    paddingHorizontal: 24,
    paddingVertical: 14,
    borderRadius: 12,
  },
  buttonText: { color: '#fff', fontWeight: '600', fontSize: 15 },
});
