package com.correx.core.talkie

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

interface TalkieRepository {
    suspend fun getTalkieState(sessionId: SessionId): TalkieState
}

class DefaultTalkieRepository(
    private val replayer: EventReplayer<TalkieState>,
) : TalkieRepository {
    override suspend fun getTalkieState(sessionId: SessionId): TalkieState =
        replayer.rebuild(sessionId)
}
