package dev.inmo.postssystem.features.content.common

import dev.inmo.postssystem.features.common.common.SerializersModuleConfigurator
import kotlinx.serialization.modules.*

class ContentSerializersModuleConfigurator(
    private val subconfigurators: List<Element>
) : SerializersModuleConfigurator.Element {
    fun interface Element {
        operator fun PolymorphicModuleBuilder<Content>.invoke()
    }

    override fun SerializersModuleBuilder.invoke() {
        polymorphic(Content::class) {
            subconfigurators.forEach { it.apply { invoke() } }
        }
    }
}
