package com.fastest.pass.home.presentation.ui.components

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.fastest.pass.R
import com.fastest.pass.home.domain.model.AddNewItem

@Composable
fun AddNewItemRow(item: AddNewItem, clickType: (ClickTypeAddNewItem) -> Unit) {
    Row(
        modifier = Modifier
            .padding(top = 10.dp)
            .border(
                border = BorderStroke(1.dp, colorResource(id = R.color.home_background_color)),
                shape = RoundedCornerShape(15.dp)
            )
            .clip(RoundedCornerShape(15.dp))
            .background(colorResource(id = R.color.white))
            .fillMaxWidth()
            .clickable {
                clickType.invoke(ClickTypeAddNewItem.valueOf(item.id))
            },
        horizontalArrangement = Arrangement.Start,
        verticalAlignment = Alignment.CenterVertically
    ) {
        Surface(
            modifier = Modifier.padding(start = 10.dp),
            color = Color.Transparent
        ) {
            Image(
                painter = painterResource(id = item.icon),
                contentDescription = "Icon",
                modifier = Modifier
                    .padding(start = 0.dp)
                    .padding(vertical = 15.dp)
                    .size(34.dp)
                    .weight(1f),
            )
        }

        Surface(
            modifier = Modifier.padding(start = 15.dp, end = 5.dp),
            color = Color.Transparent
        ) {
            Text(
                text = item.name,
                style = MaterialTheme.typography.displayMedium,
                color = colorResource(id = R.color.gray_splash),
                maxLines = 1,
                modifier = Modifier
                    .weight(1F)
            )
        }

        Spacer(modifier = Modifier.weight(1f))

        Surface(
            modifier = Modifier
                .padding(end = 15.dp)
                .align(Alignment.CenterVertically),
            color = Color.Transparent
        ) {
            Image(
                painter = painterResource(id = R.drawable.arrow_right),
                contentDescription = "Front_Arrow",
                modifier = Modifier
                    .padding(start = 0.dp, end = 0.dp)
                    .size(24.dp)
                    .weight(1f),
            )
        }
    }
}