package com.correx.core.router

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

interface RouterRepository {
    suspend fun getRouterState(sessionId: SessionId): RouterState
}

class DefaultRouterRepository(
    private val replayer: EventReplayer<RouterState>,
) : RouterRepository {
    override suspend fun getRouterState(sessionId: SessionId): RouterState =
        replayer.rebuild(sessionId)
}
