import React from 'react';
import { StyleSheet, View, Text, ScrollView, Platform } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { LinearGradient } from 'expo-linear-gradient';
import { Shield } from 'lucide-react-native';
import { useTheme } from '@/context/ThemeContext';
import { Stack } from 'expo-router';

export default function PrivacyPolicyScreen() {
  const { theme, colors } = useTheme();
  
  return (
    <SafeAreaView style={[styles.container, { backgroundColor: colors.background }]} edges={['top']}>
      <Stack.Screen options={{ 
        title: "Privacy Policy",
        headerTitleStyle: { fontWeight: 'bold' },
        headerRight: () => (
          <View style={styles.headerIconContainer}>
            <Shield size={24} color={colors.error} />
          </View>
        )
      }} />
      
      {theme === 'dark' && (
        <LinearGradient
          colors={['rgba(30, 39, 46, 0.8)', 'rgba(0, 0, 0, 1)']}
          style={styles.backgroundGradient}
        />
      )}
      
      <ScrollView 
        style={styles.content}
        showsVerticalScrollIndicator={false}
        contentContainerStyle={styles.contentContainer}
      >
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Introduction</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            BATZ Trade ("we", "our", or "us") is committed to protecting your privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our mobile application and related services.
          </Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            Please read this Privacy Policy carefully. By accessing or using the BATZ Trade application, you acknowledge that you have read, understood, and agree to be bound by all the terms of this Privacy Policy.
          </Text>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Information We Collect</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            We may collect several types of information from and about users of our application, including:
          </Text>
          <View style={styles.bulletList}>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Personal information such as name, email address, phone number, and other identifiers.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Financial information such as bank account details, payment card details, and transaction history.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Device information including IP address, device type, operating system, and browser type.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Usage data such as time spent on the application, features used, and trading activity.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Location data to provide region-specific services and comply with regulatory requirements.
            </Text>
          </View>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>How We Use Your Information</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            We may use the information we collect about you for various purposes, including:
          </Text>
          <View style={styles.bulletList}>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Providing, maintaining, and improving our services.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Processing transactions and sending related information.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Verifying your identity and preventing fraud.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Sending promotional communications and updates.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Responding to your inquiries and providing customer support.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Complying with legal and regulatory requirements.
            </Text>
          </View>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Disclosure of Your Information</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            We may disclose your personal information to:
          </Text>
          <View style={styles.bulletList}>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Service providers and partners who perform services on our behalf.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Financial institutions and payment processors to facilitate transactions.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Legal authorities when required by law or to protect our rights.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • Business partners for marketing and promotional purposes (with your consent).
            </Text>
          </View>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Data Security</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            We implement appropriate technical and organizational measures to protect the security of your personal information. However, please be aware that no method of transmission over the internet or electronic storage is 100% secure, and we cannot guarantee absolute security.
          </Text>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Your Rights</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            Depending on your location, you may have certain rights regarding your personal information, including:
          </Text>
          <View style={styles.bulletList}>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • The right to access and receive a copy of your personal information.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • The right to rectify or update your personal information.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • The right to delete your personal information.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • The right to restrict or object to processing of your personal information.
            </Text>
            <Text style={[styles.bulletItem, { color: colors.textSecondary }]}>
              • The right to data portability.
            </Text>
          </View>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Children's Privacy</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            Our services are not intended for individuals under the age of 18. We do not knowingly collect personal information from children. If you are a parent or guardian and believe your child has provided us with personal information, please contact us.
          </Text>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Changes to Our Privacy Policy</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            We may update our Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on this page and updating the "Last Updated" date. You are advised to review this Privacy Policy periodically for any changes.
          </Text>
        </View>
        
        <View style={styles.section}>
          <Text style={[styles.sectionTitle, { color: colors.text }]}>Contact Us</Text>
          <Text style={[styles.paragraph, { color: colors.textSecondary }]}>
            If you have any questions or concerns about this Privacy Policy or our data practices, please contact us at:
          </Text>
          <Text style={[styles.contactInfo, { color: colors.primary }]}>
            support@batztrade.com
          </Text>
        </View>
        
        <Text style={[styles.lastUpdated, { color: colors.textSecondary }]}>
          Last Updated: June 15, 2023
        </Text>
      </ScrollView>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  backgroundGradient: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
  },
  headerIconContainer: {
    width: 40,
    alignItems: 'flex-end',
    marginRight: 8,
  },
  content: {
    flex: 1,
  },
  contentContainer: {
    padding: 16,
    paddingBottom: 32,
  },
  section: {
    marginBottom: 24,
  },
  sectionTitle: {
    fontSize: 18,
    fontWeight: 'bold',
    marginBottom: 12,
  },
  paragraph: {
    fontSize: 14,
    lineHeight: 22,
    marginBottom: 12,
  },
  bulletList: {
    marginLeft: 8,
  },
  bulletItem: {
    fontSize: 14,
    lineHeight: 22,
    marginBottom: 8,
  },
  contactInfo: {
    fontSize: 16,
    fontWeight: '500',
    marginTop: 8,
  },
  lastUpdated: {
    fontSize: 12,
    fontStyle: 'italic',
    textAlign: 'center',
    marginTop: 16,
  },
});