package com.correx.core.sessions

import com.correx.core.events.types.SessionId
import com.correx.core.sessions.projections.replay.EventReplayer

class DefaultSessionRepository(
    private val replayer: EventReplayer<SessionState>
) {

    fun getSession(sessionId: SessionId): Session = rebuild(sessionId)

    fun rebuild(sessionId: SessionId): Session = Session(
        sessionId,
        replayer.rebuild(sessionId),
    )
}
