package com.laseroptek.raman.ui.screens.config.engineer

import android.annotation.SuppressLint
import android.content.res.Configuration
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.laseroptek.raman.R
import com.laseroptek.raman.const.ENGINEER_PIN_NUNBER
import com.laseroptek.raman.ui.common.fullscreen.FullScreen
import timber.log.Timber

@SuppressLint("UnusedContentLambdaTargetStateParameter")
@Composable
fun EngineerPasswordPopup(
    title: String = stringResource(R.string.engineer_mode_password),
    onClick: (Boolean) -> Unit= {}
) {
    FullScreen {
        remember { mutableStateOf(ENGINEER_PIN_NUNBER) }

        TextPinLock(
            title = title,
            backgroundColor = Color.Transparent,
            textColor = Color.Black,
            onClick = { ok ->
                Timber.d("onClick ok: $ok")
                onClick.invoke(ok)
            }
        )
    }
}


@Preview(
    uiMode = Configuration.UI_MODE_NIGHT_NO,
    showBackground = false,
    device = "spec:width=1920dp,height=1080dp,dpi=150,isRound=false,chinSize=0dp,orientation=landscape"
)
@Composable
fun PreviewEngineerPasswordPopup() {
    remember { mutableStateOf(true) }
    EngineerPasswordPopup()
}