2018-09-14 08:13:29 +00:00
|
|
|
package com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.models
|
|
|
|
|
2018-09-15 06:09:31 +00:00
|
|
|
import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.CeilInfo
|
2019-03-15 02:54:38 +00:00
|
|
|
import kotlinx.serialization.Serializable
|
2018-09-14 08:13:29 +00:00
|
|
|
|
2019-03-15 02:54:38 +00:00
|
|
|
@Serializable
|
2018-09-15 06:09:31 +00:00
|
|
|
data class CeilInfoConfig(
|
2018-09-14 08:13:29 +00:00
|
|
|
val title: String = "",
|
|
|
|
val description: String = "",
|
|
|
|
val note: String? = null,
|
|
|
|
val characteristics: List<CeilCharacteristic> = emptyList()
|
|
|
|
) {
|
2018-09-15 06:09:31 +00:00
|
|
|
fun toCeilDescription(countOfCharacteristic: Int): CeilInfo {
|
|
|
|
return CeilInfo(
|
2018-09-14 08:13:29 +00:00
|
|
|
title,
|
|
|
|
description,
|
|
|
|
countOfCharacteristic.let {
|
|
|
|
if (characteristics.size <= it) {
|
|
|
|
characteristics.lastOrNull() ?: description
|
|
|
|
} else {
|
|
|
|
characteristics[it]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
note
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|