/*
 * Copyright 2024 Mifos Initiative
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 *
 * See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
 */
package org.mifos.library.passcode.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Color.Companion.Blue

private val DarkColorPalette = darkColorScheme(
    primary = Color.Cyan,
    onPrimary = Color.Cyan,
    secondary = Color.Black.copy(alpha = 0.2f),
    background = Color.Black,
)
private val LightColorPalette = lightColorScheme(
    primary = Blue,
    onPrimary = Blue,
    secondary = Color.Blue.copy(alpha = 0.4f),
    background = Color.White,
)

@Composable
internal fun MifosPasscodeTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit,
) {
    val colors = if (darkTheme) {
        DarkColorPalette
    } else {
        LightColorPalette
    }

    MaterialTheme(
        colorScheme = colors,
        typography = getTypography(),
        content = content,
    )
}
