package com.correx.core.context

import com.correx.core.context.state.ContextState
import com.correx.core.events.events.ContextSummarizedEvent
import com.correx.core.events.events.StoredEvent

class DefaultContextReducer : ContextReducer {
    override fun reduce(state: ContextState, event: StoredEvent): ContextState =
        when (val p = event.payload) {
            is ContextSummarizedEvent -> state.copy(
                summarizedThroughSequence = p.coversThroughSequence,
                summaryArtifactId = p.summaryArtifactId,
                summaryTier = p.tier,
            )
            else -> state
        }
}
