package com.fastest.pass.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.foundation.layout.statusBarsPadding
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.dp
import androidx.compose.ui.unit.sp
import com.fastest.pass.R
import com.fastest.pass.ui.theme.outfitFontFamily

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