package moe.lava.neon.core.repository

import moe.lava.neon.api.gateway.GatewayHandler
import moe.lava.neon.core.AppSettings

class GatewayRepository internal constructor(
    private val gateway: GatewayHandler,
    private val settings: AppSettings,
) {
    suspend fun start(): Result<Unit> = runCatching {
        val token = settings.token
            ?: throw IllegalArgumentException("Tried to start gateway with no token")

        gateway.connect(token)
    }

    suspend fun pause() = runCatching { gateway.disconnect() }
}
