package com.example.wabi.view.screens.basket.items

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.dp
import com.example.wabi.R
import com.example.wabi.ui.theme.WabiTheme

//кнопка для копирования ссылки на корзинуть пользователя в буфер обмена телефона
@Composable
fun SharedLink(
    linkUserBasket: String, modifier: Modifier = Modifier
) {
    val clipboardManager = LocalClipboardManager.current

    Button(
        onClick = {
            clipboardManager.setText(AnnotatedString(linkUserBasket))
        },
        colors = ButtonDefaults.buttonColors(
            contentColor = WabiTheme.colors.backgroundColor,
            containerColor = WabiTheme.colors.mainColor
        ),
        shape = RoundedCornerShape(15.dp),
        contentPadding = PaddingValues(horizontal = 30.dp, vertical = 6.dp),
        modifier = modifier
    ) {
        Icon(
            imageVector = ImageVector.vectorResource(id = R.drawable.link_vector),
            contentDescription = "basket link",
        )
    }
}