package com.dong.maxhap.nestedlib4

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

@Stable
data class StableData666_1(
    val id: Int = 666001,
    val name: String = "Stable_666_1",
    val value: Double = 666.1,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_1? = null
)

@Stable
data class NestedStableData666_1(
    val subId: Int = 66601,
    val description: String = "Nested stable data for page 666, item 1",
    val count: Int = 100,
    val isEnabled: Boolean = false
)

@Stable
data class StableData666_2(
    val id: Int = 666002,
    val name: String = "Stable_666_2",
    val value: Double = 666.2,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_2? = null
)

@Stable
data class NestedStableData666_2(
    val subId: Int = 66602,
    val description: String = "Nested stable data for page 666, item 2",
    val count: Int = 200,
    val isEnabled: Boolean = true
)

@Stable
data class StableData666_3(
    val id: Int = 666003,
    val name: String = "Stable_666_3",
    val value: Double = 666.3,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_3? = null
)

@Stable
data class NestedStableData666_3(
    val subId: Int = 66603,
    val description: String = "Nested stable data for page 666, item 3",
    val count: Int = 300,
    val isEnabled: Boolean = false
)

@Stable
data class StableData666_4(
    val id: Int = 666004,
    val name: String = "Stable_666_4",
    val value: Double = 666.4,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_4? = null
)

@Stable
data class NestedStableData666_4(
    val subId: Int = 66604,
    val description: String = "Nested stable data for page 666, item 4",
    val count: Int = 400,
    val isEnabled: Boolean = true
)

@Stable
data class StableData666_5(
    val id: Int = 666005,
    val name: String = "Stable_666_5",
    val value: Double = 666.5,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_5? = null
)

@Stable
data class NestedStableData666_5(
    val subId: Int = 66605,
    val description: String = "Nested stable data for page 666, item 5",
    val count: Int = 500,
    val isEnabled: Boolean = false
)

@Stable
data class StableData666_6(
    val id: Int = 666006,
    val name: String = "Stable_666_6",
    val value: Double = 666.6,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_6? = null
)

@Stable
data class NestedStableData666_6(
    val subId: Int = 66606,
    val description: String = "Nested stable data for page 666, item 6",
    val count: Int = 600,
    val isEnabled: Boolean = true
)

@Stable
data class StableData666_7(
    val id: Int = 666007,
    val name: String = "Stable_666_7",
    val value: Double = 666.7,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_7? = null
)

@Stable
data class NestedStableData666_7(
    val subId: Int = 66607,
    val description: String = "Nested stable data for page 666, item 7",
    val count: Int = 700,
    val isEnabled: Boolean = false
)

@Stable
data class StableData666_8(
    val id: Int = 666008,
    val name: String = "Stable_666_8",
    val value: Double = 666.8,
    val isActive: Boolean = true,    val tags: List<String> = listOf("tag1", "tag2", "tag3"),
    val metadata: Map<String, String> = mapOf("key1" to "value1", "key2" to "value2"),
    val nestedData: NestedStableData666_8? = null
)

@Stable
data class NestedStableData666_8(
    val subId: Int = 66608,
    val description: String = "Nested stable data for page 666, item 8",
    val count: Int = 800,
    val isEnabled: Boolean = true
)

@Composable
internal fun NestedPage666() {
    var showNextPage by remember { mutableStateOf(false) }
    val stableData1 by remember { mutableStateOf(StableData666_1()) }
    val stableData2 by remember { mutableStateOf(StableData666_2()) }
    val stableData3 by remember { mutableStateOf(StableData666_3()) }
    val stableData4 by remember { mutableStateOf(StableData666_4()) }

    
    
    

    var showNextPage666 by remember { mutableStateOf(false) }

    if (showNextPage666) {
        NestedPage667()
        return
    }

    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(16.dp),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
        Text(
            text = "第666层页面 (nestedlib4)",
            fontSize = 24.sp,
            fontWeight = FontWeight.Bold,
            color = Color(0xFF1500000),
            modifier = Modifier.padding(bottom = 20.dp)
        )
        Text(
            text = "这是第6651行内容",
            fontSize = 14.sp,
            color = Color(171, 101, 21),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6652行内容",
            fontSize = 14.sp,
            color = Color(188, 132, 68),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6653行内容",
            fontSize = 14.sp,
            color = Color(205, 163, 115),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6654行内容",
            fontSize = 14.sp,
            color = Color(222, 194, 162),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6655行内容",
            fontSize = 14.sp,
            color = Color(239, 225, 209),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6656行内容",
            fontSize = 14.sp,
            color = Color(0, 0, 0),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6657行内容",
            fontSize = 14.sp,
            color = Color(17, 31, 47),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6658行内容",
            fontSize = 14.sp,
            color = Color(34, 62, 94),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6659行内容",
            fontSize = 14.sp,
            color = Color(51, 93, 141),
            modifier = Modifier.padding(vertical = 3.dp)
        )
        Text(
            text = "这是第6660行内容",
            fontSize = 14.sp,
            color = Color(68, 124, 188),
            modifier = Modifier.padding(vertical = 3.dp)
        )

        Spacer(modifier = Modifier.height(25.dp))
        // 显示@Stable数据信息
        Text(
            text = "StableData666_1: ID=${stableData1.id}, Name=${stableData1.name}",
            fontSize = 12.sp,
            color = Color.Gray,
            modifier = Modifier.padding(vertical = 2.dp)
        )
        Text(
            text = "NestedStableData666_1: ID=${stableData2.id}, Name=${stableData2.name}",
            fontSize = 12.sp,
            color = Color.Gray,
            modifier = Modifier.padding(vertical = 2.dp)
        )
        Text(
            text = "NestedStableData666_2: ID=${stableData3.id}, Name=${stableData3.name}",
            fontSize = 12.sp,
            color = Color.Gray,
            modifier = Modifier.padding(vertical = 2.dp)
        )

        Button(
            onClick = { showNextPage666 = true },
            modifier = Modifier
                .fillMaxWidth()
                .height(45.dp),
            colors = ButtonDefaults.buttonColors(
                backgroundColor = Color(0xFF2196F3)
            )
        ) {
            Text(
                text = "进入同库第667层",
                fontSize = 16.sp,
                fontWeight = FontWeight.Medium,
                color = Color.White
            )
        }
    }
}
