package com.aiosman.riderpro.ui.index.tabs.profile.composable

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Clear
import androidx.compose.material3.Icon
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.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.aiosman.riderpro.R
import com.aiosman.riderpro.entity.AccountProfileEntity
import com.aiosman.riderpro.ui.modifiers.noRippleClickable

@Composable
fun OtherProfileAction(
    profile: AccountProfileEntity,
    onFollow: (() -> Unit)? = null,
    onChat: (() -> Unit)? = null
) {
    Row(
        verticalAlignment = Alignment.CenterVertically,
        horizontalArrangement = Arrangement.Center,
    ) {
        Row(
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.Center,
            modifier = Modifier
                .clip(RoundedCornerShape(32.dp))
                .background(if (profile.isFollowing) Color(0xffebebeb) else Color(0xffda3833))
                .padding(horizontal = 16.dp, vertical = 4.dp)
                .noRippleClickable {
                    onFollow?.invoke()
                }
        ) {
            if (profile.isFollowing) {
                Icon(
                    Icons.Default.Clear,
                    contentDescription = "",
                    modifier = Modifier.size(24.dp),
                    tint = Color.Black
                )
            } else {
                Icon(
                    Icons.Default.Add,
                    contentDescription = "",
                    modifier = Modifier.size(24.dp),
                    tint = Color.White
                )
            }
            Spacer(modifier = Modifier.width(4.dp))
            Text(
                text = stringResource(if (profile.isFollowing) R.string.unfollow_upper else R.string.follow_upper),
                fontSize = 14.sp,
                fontWeight = FontWeight.W600,
                color = if (profile.isFollowing) Color.Black else Color.White,
                modifier = Modifier.padding(8.dp),
            )

        }
        Spacer(modifier = Modifier.width(8.dp))
        Row(
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.Center,
            modifier = Modifier
                .clip(RoundedCornerShape(32.dp))
                .background(Color(0xffebebeb))
                .padding(horizontal = 16.dp, vertical = 4.dp)
                .noRippleClickable {
                    onChat?.invoke()
                }
        ) {
            Image(
                painter = painterResource(id = R.drawable.rider_pro_comment),
                contentDescription = "",
                modifier = Modifier.size(24.dp),
            )
            Spacer(modifier = Modifier.width(4.dp))
            Text(
                text = stringResource(R.string.chat_upper),
                fontSize = 14.sp,
                fontWeight = FontWeight.W600,
                color = Color.Black,
                modifier = Modifier.padding(8.dp),
            )

        }
    }
    // 按钮

}