package com.fireworksdk.bridge.models import com.fireworksdk.bridge.models.enums.FWAppearanceMode import org.json.JSONObject object FWCountdownTimerConfigurationModelDeserializer { private const val IS_HIDDEN_KEY = "isHidden" private const val APPEARANCE_KEY = "appearance" fun deserialize(responseJson: JSONObject?): FWCountdownTimerConfigurationModel? { responseJson ?: return null val isHidden = responseJson.optBoolean(IS_HIDDEN_KEY, true) val appearance = if (responseJson.has(APPEARANCE_KEY)) responseJson.optString(APPEARANCE_KEY) else null return FWCountdownTimerConfigurationModel( isHidden = isHidden, appearance = if (!appearance.isNullOrBlank()) FWAppearanceMode.deserialize(appearance) else null, ) } }