import { View, Text, StyleSheet, ScrollView, Pressable, Platform } from 'react-native'
import { StatusBar } from 'expo-status-bar'
import { SafeAreaView } from 'react-native-safe-area-context'
import { useRouter } from 'expo-router'
import { StatusBar as RNStatusBar } from 'react-native'
import { useTranslation } from 'react-i18next'
import { LeftArrowIcon } from '@/components/icon'

export default function TermsScreen() {
    const router = useRouter()
    const { t } = useTranslation()
    return (
        <SafeAreaView style={styles.container} edges={['top']}>
            <StatusBar style="light" />
            <RNStatusBar 
                barStyle="light-content" 
                backgroundColor="#090A0B"
                translucent={Platform.OS === 'android'}
            />
            <View style={styles.header}>
                <Pressable
                    style={styles.backButton}
                    onPress={() => {
                        router.back()
                    }}
                    hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
                >
                    <LeftArrowIcon className="w-4 h-4" />
                </Pressable>
                <Text style={styles.headerTitle}>{t('terms.title')}</Text>
                <View style={styles.headerSpacer} />
            </View>
            <ScrollView
                style={styles.scrollView}
                contentContainerStyle={styles.scrollContent}
                showsVerticalScrollIndicator={false}
            >
                <Text style={styles.title}>服务条款 / Terms of Service</Text>
                
                <Text style={styles.sectionTitle}>1. 引言 / Introduction</Text>
                <Text style={styles.paragraph}>
                    欢迎使用 BOWONG AI (HK) LIMITED（以下简称"我们"或"本公司"）提供的服务。在使用我们的服务之前，请仔细阅读本服务条款。通过访问或使用我们的服务，您同意受本条款的约束。
                </Text>
                <Text style={styles.paragraph}>
                    Welcome to the services provided by BOWONG AI (HK) LIMITED (hereinafter referred to as "we" or "our company"). Please read these Terms of Service carefully before using our services. By accessing or using our services, you agree to be bound by these terms.
                </Text>

                <Text style={styles.sectionTitle}>2. 服务描述 / Service Description</Text>
                
                <Text style={styles.subsectionTitle}>2.1 服务内容 / Service Content</Text>
                <Text style={styles.paragraph}>
                    我们提供基于人工智能的设计和内容生成服务，包括但不限于：
                </Text>
                <Text style={styles.paragraph}>
                    We provide AI-based design and content generation services, including but not limited to:
                </Text>
                <Text style={styles.listItem}>• AI 驱动的设计工具和模板生成 / AI-powered design tools and template generation</Text>
                <Text style={styles.listItem}>• 创意内容生成和编辑功能 / Creative content generation and editing features</Text>
                <Text style={styles.listItem}>• 设计项目管理和协作工具 / Design project management and collaboration tools</Text>
                <Text style={styles.listItem}>• 其他相关技术服务 / Other related technical services</Text>

                <Text style={styles.subsectionTitle}>2.2 服务变更 / Service Modifications</Text>
                <Text style={styles.paragraph}>
                    我们保留随时修改、暂停或终止任何服务的权利，恕不另行通知。我们不对因服务变更而可能导致的任何损失承担责任。
                </Text>
                <Text style={styles.paragraph}>
                    We reserve the right to modify, suspend, or terminate any service at any time without prior notice. We shall not be liable for any losses that may result from service modifications.
                </Text>

                <Text style={styles.sectionTitle}>3. 用户账户 / User Accounts</Text>
                
                <Text style={styles.subsectionTitle}>3.1 账户注册 / Account Registration</Text>
                <Text style={styles.paragraph}>
                    要使用我们的服务，您需要创建一个账户。注册时，您必须：
                </Text>
                <Text style={styles.paragraph}>
                    To use our services, you need to create an account. When registering, you must:
                </Text>
                <Text style={styles.listItem}>• 提供真实、准确、完整的信息 / Provide true, accurate, and complete information</Text>
                <Text style={styles.listItem}>• 维护并及时更新您的账户信息 / Maintain and promptly update your account information</Text>
                <Text style={styles.listItem}>• 对您账户下的所有活动负责 / Be responsible for all activities under your account</Text>

                <Text style={styles.subsectionTitle}>3.2 账户安全 / Account Security</Text>
                <Text style={styles.paragraph}>
                    您有责任维护账户信息的机密性，包括您的密码。您同意对您账户下的所有活动负责，并立即通知我们任何未经授权的使用。
                </Text>
                <Text style={styles.paragraph}>
                    You are responsible for maintaining the confidentiality of your account information, including your password. You agree to be responsible for all activities under your account and to immediately notify us of any unauthorized use.
                </Text>

                <Text style={styles.sectionTitle}>4. 使用规范 / Acceptable Use</Text>
                
                <Text style={styles.subsectionTitle}>4.1 合法使用 / Legal Use</Text>
                <Text style={styles.paragraph}>
                    您同意仅将我们的服务用于合法目的，并遵守所有适用的法律法规。
                </Text>
                <Text style={styles.paragraph}>
                    You agree to use our services only for lawful purposes and in compliance with all applicable laws and regulations.
                </Text>

                <Text style={styles.subsectionTitle}>4.2 禁止行为 / Prohibited Activities</Text>
                <Text style={styles.paragraph}>您不得：</Text>
                <Text style={styles.paragraph}>You shall not:</Text>
                <Text style={styles.listItem}>• 使用服务从事任何非法活动 / Use the service for any illegal activities</Text>
                <Text style={styles.listItem}>• 上传、发布或传输任何违法、有害、威胁、辱骂、骚扰、诽谤、粗俗、淫秽或其他令人反感的内容 / Upload, post, or transmit any illegal, harmful, threatening, abusive, harassing, defamatory, vulgar, obscene, or otherwise objectionable content</Text>
                <Text style={styles.listItem}>• 侵犯他人的知识产权或其他权利 / Infringe upon the intellectual property or other rights of others</Text>
                <Text style={styles.listItem}>• 干扰或破坏服务的正常运行 / Interfere with or disrupt the normal operation of the service</Text>
                <Text style={styles.listItem}>• 尝试未经授权访问任何系统或网络 / Attempt to gain unauthorized access to any system or network</Text>
                <Text style={styles.listItem}>• 使用自动化工具或脚本滥用服务 / Abuse the service using automated tools or scripts</Text>

                <Text style={styles.sectionTitle}>5. 知识产权 / Intellectual Property</Text>
                
                <Text style={styles.subsectionTitle}>5.1 我们的权利 / Our Rights</Text>
                <Text style={styles.paragraph}>
                    服务及其所有内容，包括但不限于文本、图形、徽标、图标、图像、音频剪辑、数字下载、数据编译和软件，均为我们或我们的内容提供商的财产，受版权、商标和其他知识产权法保护。
                </Text>
                <Text style={styles.paragraph}>
                    The service and all its content, including but not limited to text, graphics, logos, icons, images, audio clips, digital downloads, data compilations, and software, are the property of us or our content providers and are protected by copyright, trademark, and other intellectual property laws.
                </Text>

                <Text style={styles.subsectionTitle}>5.2 用户内容 / User Content</Text>
                <Text style={styles.paragraph}>
                    您保留对您上传或创建的内容的所有权利。通过使用我们的服务，您授予我们使用、复制、修改、分发和公开展示此类内容的非独占、全球性、免版税的许可，仅用于提供和改进我们的服务。
                </Text>
                <Text style={styles.paragraph}>
                    You retain all rights to the content you upload or create. By using our services, you grant us a non-exclusive, worldwide, royalty-free license to use, copy, modify, distribute, and publicly display such content solely for the purpose of providing and improving our services.
                </Text>

                <Text style={styles.sectionTitle}>6. 付费服务 / Paid Services</Text>
                
                <Text style={styles.subsectionTitle}>6.1 订阅和付款 / Subscriptions and Payments</Text>
                <Text style={styles.paragraph}>
                    某些服务可能需要付费订阅。您同意按照我们网站上显示的价格支付所有费用。所有费用均以美元或其他指定货币支付，且不可退还，除非法律另有规定或我们另有说明。
                </Text>
                <Text style={styles.paragraph}>
                    Certain services may require paid subscriptions. You agree to pay all fees as displayed on our website. All fees are payable in USD or other specified currency and are non-refundable unless otherwise stated by law or us.
                </Text>

                <Text style={styles.subsectionTitle}>6.2 自动续订 / Auto-Renewal</Text>
                <Text style={styles.paragraph}>
                    除非您取消订阅，否则订阅将自动续订。您可以在订阅设置中随时取消自动续订。
                </Text>
                <Text style={styles.paragraph}>
                    Subscriptions will automatically renew unless you cancel them. You may cancel auto-renewal at any time in your subscription settings.
                </Text>

                <Text style={styles.subsectionTitle}>6.3 退款政策 / Refund Policy</Text>
                <Text style={styles.paragraph}>
                    除非法律另有规定或我们另有说明，所有付款均为最终付款且不可退还。如果您对服务不满意，请联系我们的客户支持。
                </Text>
                <Text style={styles.paragraph}>
                    All payments are final and non-refundable unless otherwise required by law or stated by us. If you are dissatisfied with the service, please contact our customer support.
                </Text>

                <Text style={styles.sectionTitle}>7. 隐私保护 / Privacy</Text>
                <Text style={styles.paragraph}>
                    我们非常重视您的隐私。有关我们如何收集、使用和保护您的信息，请参阅我们的隐私协议。
                </Text>
                <Text style={styles.paragraph}>
                    We take your privacy seriously. Please refer to our Privacy Policy for information on how we collect, use, and protect your information.
                </Text>

                <Text style={styles.sectionTitle}>8. 免责声明 / Disclaimer</Text>
                
                <Text style={styles.subsectionTitle}>8.1 服务"按现状"提供 / Service "As Is"</Text>
                <Text style={styles.paragraph}>
                    服务按"现状"和"可用"的基础提供，不提供任何明示或暗示的保证，包括但不限于适销性、特定用途的适用性和非侵权性的保证。
                </Text>
                <Text style={styles.paragraph}>
                    The service is provided on an "as is" and "as available" basis without any express or implied warranties, including but not limited to warranties of merchantability, fitness for a particular purpose, and non-infringement.
                </Text>

                <Text style={styles.subsectionTitle}>8.2 责任限制 / Limitation of Liability</Text>
                <Text style={styles.paragraph}>
                    在法律允许的最大范围内，我们不对任何间接、偶然、特殊、后果性或惩罚性损害承担责任，即使我们已被告知此类损害的可能性。
                </Text>
                <Text style={styles.paragraph}>
                    To the maximum extent permitted by law, we shall not be liable for any indirect, incidental, special, consequential, or punitive damages, even if we have been advised of the possibility of such damages.
                </Text>

                <Text style={styles.sectionTitle}>9. 服务终止 / Termination</Text>
                
                <Text style={styles.subsectionTitle}>9.1 终止权利 / Termination Rights</Text>
                <Text style={styles.paragraph}>
                    我们保留随时终止或暂停您对服务的访问的权利，无论是否事先通知，原因包括但不限于违反本条款。
                </Text>
                <Text style={styles.paragraph}>
                    We reserve the right to terminate or suspend your access to the service at any time, with or without prior notice, for reasons including but not limited to violation of these terms.
                </Text>

                <Text style={styles.subsectionTitle}>9.2 终止后果 / Consequences of Termination</Text>
                <Text style={styles.paragraph}>
                    服务终止后，您访问服务的权利将立即终止。本条款中在终止后仍然有效的条款将继续适用。
                </Text>
                <Text style={styles.paragraph}>
                    Upon termination, your right to access the service will immediately cease. The provisions of these terms that by their nature should survive termination will continue to apply.
                </Text>

                <Text style={styles.sectionTitle}>10. 条款修改 / Modifications to Terms</Text>
                <Text style={styles.paragraph}>
                    我们保留随时修改本条款的权利。重大变更将通过电子邮件或网站公告通知您。继续使用服务即表示您接受修改后的条款。
                </Text>
                <Text style={styles.paragraph}>
                    We reserve the right to modify these terms at any time. Material changes will be notified to you via email or website notice. Continued use of the service constitutes your acceptance of the modified terms.
                </Text>

                <Text style={styles.sectionTitle}>11. 适用法律 / Governing Law</Text>
                <Text style={styles.paragraph}>
                    本条款受香港特别行政区法律管辖，并按其解释。任何争议应提交香港特别行政区有管辖权的法院解决。
                </Text>
                <Text style={styles.paragraph}>
                    These terms shall be governed by and construed in accordance with the laws of the Hong Kong Special Administrative Region. Any disputes shall be submitted to the competent courts of the Hong Kong Special Administrative Region.
                </Text>

                <Text style={styles.sectionTitle}>12. 联系我们 / Contact Us</Text>
                <Text style={styles.paragraph}>
                    如果您对本服务条款有任何疑问，请通过以下方式联系我们：
                </Text>
                <Text style={styles.paragraph}>
                    If you have any questions regarding these Terms of Service, please contact us at:
                </Text>
                <Text style={styles.listItem}>• 公司名称 / Company Name: BOWONG AI (HK) LIMITED</Text>
                <Text style={styles.listItem}>• 客服邮箱 / Support Email: support@bowong.ai</Text>

                <Text style={styles.footer}>
                    通过使用我们的服务，您确认已阅读、理解并同意遵守本服务条款。
                </Text>
                <Text style={styles.footer}>
                    By using our services, you acknowledge that you have read, understood, and agree to be bound by these Terms of Service.
                </Text>
            </ScrollView>
        </SafeAreaView>
    )
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#090A0B',
    },
    header: {
        flexDirection: 'row',
        alignItems: 'center',
        paddingHorizontal: 12,
        paddingTop: 7,
        paddingBottom: 7,
        backgroundColor: '#090A0B',
    },
    backButton: {
        width: 32,
        height: 32,
        alignItems: 'center',
        justifyContent: 'center',
        borderRadius: 100,
        zIndex: 10,
    },
    headerTitle: {
        flex: 1,
        color: '#F5F5F5',
        fontSize: 18,
        fontWeight: '600',
        textAlign: 'center',
        marginLeft: -32,
    },
    headerSpacer: {
        width: 32,
    },
    scrollView: {
        flex: 1,
    },
    scrollContent: {
        paddingHorizontal: 16,
        paddingTop: 16,
        paddingBottom: 32,
    },
    title: {
        color: '#F5F5F5',
        fontSize: 24,
        fontWeight: '900',
        marginBottom: 24,
        textAlign: 'center',
    },
    sectionTitle: {
        color: '#F5F5F5',
        fontSize: 18,
        fontWeight: '700',
        marginTop: 24,
        marginBottom: 12,
    },
    subsectionTitle: {
        color: '#F5F5F5',
        fontSize: 16,
        fontWeight: '600',
        marginTop: 16,
        marginBottom: 8,
    },
    paragraph: {
        color: '#CCCCCC',
        fontSize: 14,
        lineHeight: 22,
        marginBottom: 12,
    },
    listItem: {
        color: '#CCCCCC',
        fontSize: 14,
        lineHeight: 22,
        marginBottom: 8,
        marginLeft: 8,
    },
    footer: {
        color: '#CCCCCC',
        fontSize: 14,
        lineHeight: 22,
        marginTop: 24,
        textAlign: 'center',
        fontStyle: 'italic',
    },
})

