import React, { useState } from "react";
import { View, Text, StyleSheet, Pressable, Switch } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import Header from "../components/Header";

export default function SettingsScreen({ navigation }) {
  const [notificationsEnabled, setNotificationsEnabled] = useState(true);
  const [highQuality, setHighQuality] = useState(false);

  return (
    <SafeAreaView style={styles.container}>
      <Pressable onPress={() => navigation.goBack()} style={styles.backBtn}>
        <Text style={styles.backText}>← Back</Text>
      </Pressable>

      <Header title="Settings" showIcons={true}/>

      <View style={styles.row}>
        <Text style={styles.rowText}>Enable notifications</Text>
        <Switch
          value={notificationsEnabled}
          onValueChange={setNotificationsEnabled}
        />
      </View>

      <View style={styles.row}>
        <Text style={styles.rowText}>High quality streaming</Text>
        <Switch value={highQuality} onValueChange={setHighQuality} />
      </View>

      <Pressable
        style={[styles.logoutBtn]}
        onPress={() => console.log("Logged out")}
      >
        <Text style={styles.logoutBtnText}>Log out</Text>
      </Pressable>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#000",
    paddingTop: 24,
    paddingHorizontal: 16,
  },
  backBtn: {
    marginBottom: 10,
    alignSelf: "flex-start",
  },
  backText: {
    color: "#fff",
    fontSize: 16,
    fontWeight: "600",
  },
  title: {
    color: "#fff",
    fontSize: 30,
    fontWeight: "700",
    marginBottom: 16,
  },
  row: {
    backgroundColor: "#111827",
    borderRadius: 10,
    paddingHorizontal: 12,
    paddingVertical: 14,
    marginBottom: 10,
    flexDirection: "row",
    justifyContent: "space-between",
    alignItems: "center",
  },
  rowText: {
    color: "#fff",
    fontSize: 16,
  },
  logoutBtn: {
    borderRadius: 10,
    paddingVertical: 12,
    alignItems: "center",
    marginTop: 16,
    backgroundColor: "#e36d6d",
  },
  logoutBtnText: {
    color: "#000000",
    fontWeight: "700",
    fontSize: 16,
  },
});