package com.onthelevel.feature.ruler

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.onthelevel.AppContainer
import com.onthelevel.core.design.LevelColors

/**
 * Scaffold Screen Ruler: Pro preview only (BRIEF.md §Tools — calm, intentional
 * paywall; never an interruption in the free level/angle flow).
 * TODO(pro): guided calibration (credit-card 85.60 mm + conventional ruler),
 * scale stored per display identity, recalibration prompt on material display change.
 */
@Composable
fun RulerScreen(container: AppContainer) {
    val entitlement by container.entitlement.entitlement.collectAsStateWithLifecycle()

    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(32.dp),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {
        Text("SCREEN RULER", style = MaterialTheme.typography.labelSmall, color = LevelColors.TextDim)
        Text(
            text = if (entitlement.isPro) {
                "Ruler coming in the feature build."
            } else {
                "The calibrated screen ruler is part of On the Level Pro."
            },
            style = MaterialTheme.typography.headlineMedium,
            textAlign = TextAlign.Center,
            modifier = Modifier.padding(top = 12.dp),
        )
        Text(
            text = "For short, rough measurements only — not a substitute for a tape measure.",
            style = MaterialTheme.typography.labelSmall,
            color = LevelColors.TextDim,
            textAlign = TextAlign.Center,
            modifier = Modifier.padding(top = 16.dp),
        )
    }
}
