package com.tt.honeyDue.platform

import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import com.tt.honeyDue.network.APILayer
import com.tt.honeyDue.ui.subscription.UpgradeScreen
import kotlinx.coroutines.launch

/**
 * iOS: Purchase flow is handled in Swift via StoreKitManager.
 * Restore calls backend to refresh subscription status.
 */
@Composable
actual fun PlatformUpgradeScreen(
    onNavigateBack: () -> Unit,
    onSubscriptionChanged: () -> Unit
) {
    val scope = rememberCoroutineScope()

    UpgradeScreen(
        onNavigateBack = onNavigateBack,
        onPurchase = { _ ->
            // iOS purchase flow is handled by StoreKitManager in Swift layer
            onNavigateBack()
        },
        onRestorePurchases = {
            scope.launch {
                APILayer.getSubscriptionStatus(forceRefresh = true)
                onSubscriptionChanged()
            }
        }
    )
}
