package moe.lava.neon.core.api.gateway.handlers

import co.touchlab.kermit.Logger
import dev.zacsweers.metro.Inject
import moe.lava.neon.core.api.gateway.Event
import moe.lava.neon.core.api.gateway.ResumeProperties

private val logger = Logger.withTag("neon.core.api.events/ready")

@Inject
class ReadyHandler : Handler<Event.Ready> {
    fun handle(event: Event.Ready, updateResumeProps: (ResumeProperties) -> Unit) {
        logger.i { "Received payload $event" }
        updateResumeProps(ResumeProperties(
            sessionId = event.sessionId,
            resumeGatewayUrl = event.resumeGatewayUrl,
            lastSequence = 0,
        ))
    }
}
