package com.bigcrunch.ads.models import com.squareup.moshi.Json import com.squareup.moshi.JsonClass /** * Configuration for a single ad placement * * Contains all information needed to request and display an ad at a specific * location in the app. Bidder configuration is no longer stored here — it lives * in the top-level [AppConfig.bidders] dictionary. */ @JsonClass(generateAdapter = true) data class PlacementConfig( @Json(name = "id") val id: String, @Json(name = "placementId") val placementId: String, @Json(name = "format") val format: String, // "banner", "interstitial", "rewarded" @Json(name = "gamAdUnit") val gamAdUnit: String, @Json(name = "sizes") val sizes: List? = null, @Json(name = "refresh") val refresh: RefreshConfig? = null, @Json(name = "floorPrice") val floorPrice: Double? = null, @Json(name = "enabled") val enabled: Boolean = true ) /** * Ad size dimensions * * When [type] is "adaptive" or "smart", the SDK will use Google's adaptive * banner API to calculate the optimal height for the given [width]. * A [width] of 0 means "use screen width". */ @JsonClass(generateAdapter = true) data class AdSize( @Json(name = "width") val width: Int, @Json(name = "height") val height: Int, @Json(name = "type") val type: String? = null ) { val isAdaptive: Boolean get() = type == "adaptive" || type == "smart" companion object { fun adaptive(width: Int = 0): AdSize = AdSize(width = width, height = 0, type = "adaptive") } } /** * Refresh configuration for banner ads */ @JsonClass(generateAdapter = true) data class RefreshConfig( @Json(name = "enabled") val enabled: Boolean, @Json(name = "intervalMs") val intervalMs: Int, @Json(name = "maxRefreshes") val maxRefreshes: Int )