package com.suno.android.common_data.billing.models import androidx.compose.runtime.Immutable import kotlinx.collections.immutable.ImmutableList @Immutable data class PeriodTransitions( val upgrade: PeriodTransitionTimeframe, val downgrade: PeriodTransitionTimeframe, val crossgrade: PeriodTransitionTimeframe, ) @Immutable data class PeriodTransitionTimeframe( val immediate: ImmutableList, val endOfPeriod: ImmutableList, ) @Immutable data class PeriodTransitionRule( val from: PlanPeriod, val to: PlanPeriod, ) /** * Represents a subscription billing period */ enum class PlanPeriod( val value: String, val label: String, val displayPeriod: String, ) { Month(value = "month", label = "Monthly", displayPeriod = "monthly"), Year(value = "year", label = "Annual", displayPeriod = "annually"), ; companion object { fun fromString( value: String, ): PlanPeriod? = entries.firstOrNull { it.value.equals(value, ignoreCase = true) } fun fromDisplayPeriod( displayPeriod: String, ): PlanPeriod? = entries.firstOrNull { it.displayPeriod.equals(displayPeriod, ignoreCase = true) } } }