package com.lanyun.wanglaotou.public


import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.Role.Companion.Image
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

import com.lanyun.wanglaotou.model.NodeModel
import com.lanyun.wanglaotou.ui.theme.Default200
import com.lanyun.wanglaotou.ui.theme.colorSelected
import com.lanyun.wanglaotou.ui.theme.colorUnselected
import com.lanyun.wanglaotou.ui.theme.grey3


@Composable
fun HomeCardItemContent(
    nodeModel: NodeModel,
    ms:String,
    selected: Boolean,
    onClick: () -> Unit = {}
){
    Row(
        modifier = Modifier
            .clickable(onClick = onClick)
            .fillMaxSize()
            .padding(top = 6.dp, bottom = 6.dp, start = 5.dp, end = 10.dp),

        verticalAlignment = Alignment.CenterVertically

    ) {
        //新增 Image 圖片
        Text(
            "",
            modifier = Modifier
                .width(10.dp)
                .height(45.dp)
                .background(if (selected) colorSelected else colorUnselected)
        )

        Spacer(
            modifier = Modifier
                .width(10.dp)
        )

        Column(
            modifier = Modifier.fillMaxWidth(),
        ) {
            Row(
                modifier = Modifier.fillMaxWidth(),
                verticalAlignment = Alignment.CenterVertically
            ) {
                Text(
                    nodeModel.name
                )
                Spacer(modifier = Modifier.weight(1f,true))
                Text(text = ms)
            }

            Row(
                modifier = Modifier.fillMaxWidth(),
                verticalAlignment = Alignment.Bottom,
            ) {
                Text(
                    nodeModel.type,
                    fontSize = 12.sp,
                    color = grey3
                )
                Spacer(modifier = Modifier.width(10.dp))
                Text(text = "倍率${nodeModel.rate} x",color = grey3,fontSize = 12.sp)
                Spacer(modifier = Modifier.width(5.dp))
                nodeModel.tags?.let {
                  it.forEachIndexed { _, s ->
                      Text(text = s, fontSize = 12.sp, color = grey3)
                  }
                }
                Spacer(modifier = Modifier.weight(1f,true))
                Text(text = "")
            }
        }


    }
}