package com.suno.android.common_data.mappers.promos import com.suno.android.common_networking.remote.entities.RemoteModalsGraphicSchema /** * Domain model for CMS Modals graphic, for promotional banners */ data class DomainModalsGraphic( val id: String?, val order: Int?, val backgroundImageUrl: String?, val backgroundImageUrlMobile: String?, val backgroundColor: String?, val tagText: String?, val tagBackgroundColor: String?, val tagTextColor: String?, val title: String?, val titleColor: String?, val subtitle: String?, val subtitleColor: String?, val ctaLabel: String?, val ctaBackgroundColor: String?, val ctaTextColor: String?, val ctaUrl: String?, ) /** * Maps backend schema to domain model */ fun RemoteModalsGraphicSchema.toDomainModalsGraphic(): DomainModalsGraphic = DomainModalsGraphic( id = id, order = order, backgroundImageUrl = heroBackgroundImgUrl, backgroundImageUrlMobile = heroBackgroundImgUrlMobile, backgroundColor = heroBackgroundColor, tagText = tag?.text?.text, tagBackgroundColor = tag?.color, tagTextColor = tag?.text?.color, title = titleText?.text, titleColor = titleText?.color, subtitle = subtitleText?.text?.takeIf { it.isNotEmpty() }, subtitleColor = subtitleText?.color, ctaLabel = primaryCta?.text?.text?.takeIf { it.isNotEmpty() }, ctaBackgroundColor = primaryCta?.color, ctaTextColor = primaryCta?.text?.color, ctaUrl = primaryCta?.url, )