import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.aiosman.riderpro.BottomNavigationPlaceholder
import com.aiosman.riderpro.LocalNavController
import com.aiosman.riderpro.NoticeScreenHeader
import com.aiosman.riderpro.R
import com.aiosman.riderpro.StatusBarMask
import com.aiosman.riderpro.StatusBarMaskLayout


@Preview
@Composable
fun ModificationListScreen() {
    val navController = LocalNavController.current
    val modifications = getModifications()
    StatusBarMaskLayout {
        Column(
            modifier = Modifier
                .weight(1f)
                .padding(horizontal = 16.dp)
                .background(Color(0xFFF8F8F8))

        ) {
            NoticeScreenHeader("Modification List")
            Spacer(modifier = Modifier.height(8.dp))
            LazyColumn(modifier = Modifier.padding(16.dp)) {
                items(modifications.size) { index ->
                    val modification = modifications[index]
                    ModificationItem(name = modification.name, price = modification.price)
                    Spacer(modifier = Modifier.height(8.dp))
                }
                item {
                    BottomNavigationPlaceholder()
                }
            }
        }
    }
}

data class Modification(val name: String, val price: String)

fun getModifications(): List<Modification> {
    return listOf(
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
        Modification("Modification name", "$74.00"),
    )
}

@Composable
fun ModificationItem(name: String, price: String) {
    Card(
        shape = RoundedCornerShape(8.dp),
        modifier = Modifier.fillMaxWidth(),
        colors = CardDefaults.cardColors(
            containerColor = Color.White,
        )
    ) {
        Column(modifier = Modifier.padding(16.dp)) {
            Text(text = name, fontSize = 16.sp, fontWeight = FontWeight.Bold)
            Spacer(modifier = Modifier.height(8.dp))
            Text(text = price, fontSize = 16.sp, fontWeight = FontWeight.Bold, color = Color.Red)
        }
    }
}
