package com.vpn.fastestvpnservice.views

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.Snackbar
import androidx.compose.material3.Icon
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.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.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.vpn.fastestvpnservice.R
import com.vpn.fastestvpnservice.ui.theme.outfitFontFamily

@Composable
fun ShowCustomSnackBar(snackBarState: SnackbarHostState) {
    SnackbarHost(
        hostState = snackBarState,
        modifier = Modifier.padding(10.dp)
    ) {data ->
        Snackbar(
            elevation = 0.dp,
            backgroundColor = colorResource(id = R.color.yellow_text)
        ) {
            Box(
                modifier = Modifier
            ) {
                Row(
                    verticalAlignment = Alignment.CenterVertically,
                    modifier = Modifier
                ) {
                    Icon(painter = painterResource(id = R.drawable.logo_black),
                        contentDescription = "Error",
                        tint = Color.Unspecified,
                        modifier = Modifier.size(16.dp)
                    )
                    Text(text = data.visuals.message,
                        style = TextStyle(
                            fontFamily = outfitFontFamily,
                            fontWeight = FontWeight.Medium,
                            fontSize = 16.sp,
                            color = colorResource(id = R.color.dark_blue_gray_text)
                        ),
                        modifier = Modifier.padding(start = 10.dp)
                    )
                }
            }
        }
    }
}