package com.correx.core.sessions

import com.correx.core.events.events.StoredEvent
import com.correx.core.sessions.projections.Projection

class SessionProjector(
    private val reducer: SessionReducer
) : Projection<SessionState> {

    override fun initial(): SessionState =
        SessionState(
            status = SessionStatus.CREATED
        )

    override fun apply(
        state: SessionState,
        event: StoredEvent
    ): SessionState = reducer.reduce(state, event)
}
