package com.correx.core.context.model

import kotlinx.serialization.Serializable

/**
 * Per-sourceType token ceilings for OPTIONAL bucket entries. Defaults are tuned for the
 * 9–26B local-model tier running a 16k prompt budget: the optional block as a whole stays
 * under ~5k tokens so the required block (task, constraints, loaded inputs, failures) and
 * the running transcript always dominate the window.
 *
 * A source type absent from [caps] has no per-type ceiling — it is still bounded by the
 * remaining post-required budget like everything else.
 */
@Serializable
data class OptionalCeilings(
    val caps: Map<String, Int> = DEFAULT_CAPS,
) {
    fun capFor(sourceType: String): Int? = caps[sourceType]

    companion object {
        val DEFAULT_CAPS: Map<String, Int> = mapOf(
            "repoMap" to 1200,
            "relevantFiles" to 1600,
            "decisionJournal" to 800,
            "operatorProfile" to 400,
            "projectProfile" to 600,
            "artifactKindVocabulary" to 400,
        )
    }
}
