package com.correx.core.context.model

import com.correx.core.events.types.ContextEntryId
import kotlinx.serialization.Serializable

enum class EntryRole { SYSTEM, USER, ASSISTANT, TOOL }

@Serializable
data class ContextEntry(
    val id: ContextEntryId,
    val layer: ContextLayer,
    val content: String,
    val sourceType: String,
    val sourceId: String,
    val tokenEstimate: Int,
    val role: EntryRole = EntryRole.USER,
    // Monotonic chronological position within a single context assembly. Stamped by
    // DefaultContextPackBuilder from input order so that grouping/compression (which
    // reorder by sourceType/layer) and PromptRenderer can recover true turn order.
    // Entries built outside that builder (e.g. router chat) leave this at 0 and fall
    // back to layer-priority ordering in PromptRenderer.
    val ordinal: Int = 0,
)
