package com.dong.maxhap.demos

import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.dong.maxhap.nestedlib1.NestedPage1

@Composable
internal fun NestedLibsDemo() {
    var showEntryPoint by remember { mutableStateOf(false) }
    
    if (showEntryPoint) {
        // 从第一个库的第一个页面开始
        NestedPage1()
        return
    }
    
    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(16.dp),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
        Text(
            text = "嵌套库演示",
            fontSize = 28.sp,
            fontWeight = FontWeight.Bold,
            color = Color(0xFF2196F3),
            modifier = Modifier.padding(bottom = 30.dp)
        )
        
        Text(
            text = "5个库，每个包含200个嵌套页面",
            fontSize = 18.sp,
            modifier = Modifier.padding(bottom = 10.dp)
        )
        
        Text(
            text = "总共1000层嵌套页面",
            fontSize = 16.sp,
            color = Color.Gray,
            modifier = Modifier.padding(bottom = 30.dp)
        )
        
        Button(
            onClick = { showEntryPoint = true },
            modifier = Modifier
                .fillMaxWidth()
                .height(50.dp),
            colors = ButtonDefaults.buttonColors(
                backgroundColor = Color(0xFF4CAF50)
            )
        ) {
            Text(
                text = "开始嵌套之旅",
                fontSize = 18.sp,
                fontWeight = FontWeight.Medium,
                color = Color.White
            )
        }
        
        Spacer(modifier = Modifier.height(20.dp))
        
        Text(
            text = "页面分布:",
            fontSize = 16.sp,
            fontWeight = FontWeight.Bold,
            modifier = Modifier.padding(bottom = 10.dp)
        )
        
        Column(
            modifier = Modifier.fillMaxWidth(),
            horizontalAlignment = Alignment.Start
        ) {
            Text("• nestedlib1: 页面 1-200", fontSize = 14.sp, color = Color(0xFF100000))
            Text("• nestedlib2: 页面 201-400", fontSize = 14.sp, color = Color(0xFF320000))
            Text("• nestedlib3: 页面 401-600", fontSize = 14.sp, color = Color(0xFF640000))
            Text("• nestedlib4: 页面 601-800", fontSize = 14.sp, color = Color(0xFF960000))
            Text("• nestedlib5: 页面 801-1000", fontSize = 14.sp, color = Color(0xFFC80000))
        }
    }
}