package com.suno.android.common_data.billing.mappers import arrow.core.Either import arrow.core.raise.either import arrow.core.raise.ensure import com.suno.android.common_networking.remote.entities.RemoteAudioUploadLimits import kotlin.time.Duration import kotlin.time.Duration.Companion.INFINITE import kotlin.time.Duration.Companion.ZERO import kotlin.time.Duration.Companion.seconds fun RemoteAudioUploadLimits.toDurationRange(): Either> = either { val min = this@toDurationRange.min?.seconds ?: ZERO val max = this@toDurationRange.max?.seconds ?: INFINITE ensure(min < max) { java.lang.IllegalStateException("min ($min) must be less than max ($max)") } min..max }