package com.suno.android.extensions import arrow.core.Either import arrow.core.raise.either import com.suno.android.common_core_utils.Id import com.suno.android.common_core_utils.model.Url import com.suno.android.common_data.mappers.promos.DomainModalsGraphic import com.suno.android.common_ui.models.Promo fun DomainModalsGraphic.xAsPromo( onCtaClick: () -> Unit, ): Either = let { model -> either { Promo( id = model.id?.let(::Id) ?: raise(Unit), title = model.title, titleColor = model.titleColor?.xAsColor(), subtitle = model.subtitle, subtitleColor = model.subtitleColor?.xAsColor(), tagText = model.tagText, tagBackgroundColor = model.tagBackgroundColor?.xAsColor(), tagTextColor = model.tagTextColor?.xAsColor(), ctaLabel = model.ctaLabel, ctaBackgroundColor = model.ctaBackgroundColor?.xAsColor(), ctaTextColor = model.ctaTextColor?.xAsColor(), backgroundImageUrl = model.backgroundImageUrl?.let(::Url), backgroundImageUrlMobile = model.backgroundImageUrlMobile?.let(::Url), backgroundColor = model.backgroundColor?.xAsColor(), onCtaClick = onCtaClick, ) } }