package com.blaze.rtnblazesdk.utils import com.blaze.blazesdk.delegates.models.BlazeCTAActionType import com.blaze.blazesdk.prefetch.models.BlazeCachingLevel import com.blaze.blazesdk.style.widgets.BlazeWidgetLayout internal fun String.extractCachingLevel(): BlazeCachingLevel? { return when(this) { "LOW" -> BlazeCachingLevel.LOW "DEFAULT" -> BlazeCachingLevel.DEFAULT "HIGH" -> BlazeCachingLevel.HIGH "EXTREME" -> BlazeCachingLevel.EXTREME else -> null } } internal fun BlazeCTAActionType.mapToReact(): String { return when (this) { BlazeCTAActionType.DEEPLINK -> "Deeplink" BlazeCTAActionType.WEB -> "Web" } } fun String.asWidgetLayoutPreset(): BlazeWidgetLayout? { return when (this) { // Stories Row "StoriesWidget.Row.circles" -> BlazeWidgetLayout.Presets.StoriesWidget.Row.circles "StoriesWidget.Row.verticalRectangles" -> BlazeWidgetLayout.Presets.StoriesWidget.Row.verticalRectangles "StoriesWidget.Row.horizontalRectangles" -> BlazeWidgetLayout.Presets.StoriesWidget.Row.horizontalRectangles "StoriesWidget.Row.singleItemVerticalRectangle" -> BlazeWidgetLayout.Presets.StoriesWidget.Row.singleItemVerticalRectangle "StoriesWidget.Row.singleItemHorizontalRectangle" -> BlazeWidgetLayout.Presets.StoriesWidget.Row.singleItemHorizontalRectangle // Stories Grid "StoriesWidget.Grid.oneColumnHorizontalRectangles" -> BlazeWidgetLayout.Presets.StoriesWidget.Grid.oneColumnHorizontalRectangles "StoriesWidget.Grid.twoColumnsVerticalRectangles" -> BlazeWidgetLayout.Presets.StoriesWidget.Grid.twoColumnsVerticalRectangles "StoriesWidget.Grid.twoColumnsHorizontalRectangles" -> BlazeWidgetLayout.Presets.StoriesWidget.Grid.twoColumnsHorizontalRectangles "StoriesWidget.Grid.threeColumnsVerticalRectangles" -> BlazeWidgetLayout.Presets.StoriesWidget.Grid.threeColumnsVerticalRectangles "StoriesWidget.Grid.threeColumnsHorizontalRectangles" -> BlazeWidgetLayout.Presets.StoriesWidget.Grid.threeColumnsHorizontalRectangles "StoriesWidget.Grid.singleItemVerticalRectangle" -> BlazeWidgetLayout.Presets.StoriesWidget.Grid.singleItemVerticalRectangle "StoriesWidget.Grid.singleItemHorizontalRectangle" -> BlazeWidgetLayout.Presets.StoriesWidget.Grid.singleItemHorizontalRectangle // Moments Row "MomentsWidget.Row.verticalRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Row.verticalRectangles "MomentsWidget.Row.horizontalRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Row.horizontalRectangles "MomentsWidget.Row.singleItemVerticalRectangle" -> BlazeWidgetLayout.Presets.MomentsWidget.Row.singleItemVerticalRectangle "MomentsWidget.Row.singleItemHorizontalRectangle" -> BlazeWidgetLayout.Presets.MomentsWidget.Row.singleItemHorizontalRectangle "MomentsWidget.Row.verticalAnimatedThumbnailsRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Row.verticalAnimatedThumbnailsRectangles // Moments Grid "MomentsWidget.Grid.oneColumnHorizontalRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Grid.oneColumnHorizontalRectangles "MomentsWidget.Grid.twoColumnsVerticalRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Grid.twoColumnsVerticalRectangles "MomentsWidget.Grid.twoColumnsHorizontalRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Grid.twoColumnsHorizontalRectangles "MomentsWidget.Grid.threeColumnsVerticalRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Grid.threeColumnsVerticalRectangles "MomentsWidget.Grid.threeColumnsHorizontalRectangles" -> BlazeWidgetLayout.Presets.MomentsWidget.Grid.threeColumnsHorizontalRectangles "MomentsWidget.Grid.singleItemVerticalRectangle" -> BlazeWidgetLayout.Presets.MomentsWidget.Grid.singleItemVerticalRectangle "MomentsWidget.Grid.singleItemHorizontalRectangle" -> BlazeWidgetLayout.Presets.MomentsWidget.Grid.singleItemHorizontalRectangle // Videos Row "VideosWidget.Row.verticalRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Row.verticalRectangles "VideosWidget.Row.horizontalRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Row.horizontalRectangles "VideosWidget.Row.singleItemVerticalRectangle" -> BlazeWidgetLayout.Presets.VideosWidget.Row.singleItemVerticalRectangle "VideosWidget.Row.singleItemHorizontalRectangle" -> BlazeWidgetLayout.Presets.VideosWidget.Row.singleItemHorizontalRectangle "VideosWidget.Row.verticalAnimatedThumbnailsRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Row.verticalAnimatedThumbnailsRectangles // Videos Grid "VideosWidget.Grid.oneColumnHorizontalRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Grid.oneColumnHorizontalRectangles "VideosWidget.Grid.twoColumnsVerticalRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Grid.twoColumnsVerticalRectangles "VideosWidget.Grid.twoColumnsHorizontalRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Grid.twoColumnsHorizontalRectangles "VideosWidget.Grid.threeColumnsVerticalRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Grid.threeColumnsVerticalRectangles "VideosWidget.Grid.threeColumnsHorizontalRectangles" -> BlazeWidgetLayout.Presets.VideosWidget.Grid.threeColumnsHorizontalRectangles "VideosWidget.Grid.singleItemVerticalRectangle" -> BlazeWidgetLayout.Presets.VideosWidget.Grid.singleItemVerticalRectangle "VideosWidget.Grid.singleItemHorizontalRectangle" -> BlazeWidgetLayout.Presets.VideosWidget.Grid.singleItemHorizontalRectangle else -> null } }