package app.closer.ui.settings

import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import app.closer.ui.theme.isCloserDarkTheme

internal val SettingsBackgroundBrush: Brush
    @Composable
    get() {
        val colors = if (isCloserDarkTheme()) {
            listOf(
                MaterialTheme.colorScheme.background,
                MaterialTheme.colorScheme.surface,
                MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.72f)
            )
        } else {
            listOf(
                MaterialTheme.colorScheme.background,
                MaterialTheme.colorScheme.surfaceVariant,
                MaterialTheme.colorScheme.secondaryContainer
            )
        }
        return Brush.linearGradient(
            colors = colors,
            start = Offset.Zero,
            end = Offset.Infinite
        )
    }

internal val SettingsInk: Color
    @Composable get() = MaterialTheme.colorScheme.onBackground
internal val SettingsMuted: Color
    @Composable get() = MaterialTheme.colorScheme.onSurfaceVariant
internal val SettingsPrimary: Color
    @Composable get() = MaterialTheme.colorScheme.primary
internal val SettingsPrimaryDeep: Color
    @Composable get() = MaterialTheme.colorScheme.onPrimaryContainer
internal val SettingsOnPrimary: Color
    @Composable get() = MaterialTheme.colorScheme.onPrimary
internal val SettingsCard: Color
    @Composable get() = MaterialTheme.colorScheme.surface
internal val SettingsSoft: Color
    @Composable get() = MaterialTheme.colorScheme.primaryContainer
internal val SettingsDanger: Color
    @Composable get() = MaterialTheme.colorScheme.error

@Composable
internal fun settingsSwitchColors() = SwitchDefaults.colors(
    checkedThumbColor = SettingsPrimary,
    checkedTrackColor = SettingsPrimary.copy(alpha = 0.42f),
    uncheckedThumbColor = SettingsMuted.copy(alpha = 0.72f),
    uncheckedTrackColor = SettingsMuted.copy(alpha = 0.16f)
)
