package kr.co.vividnext.sodalive.live.roulette

import io.reactivex.rxjava3.core.Single
import kr.co.vividnext.sodalive.common.ApiResponse
import kr.co.vividnext.sodalive.live.roulette.config.CreateOrUpdateRouletteRequest
import kr.co.vividnext.sodalive.live.roulette.config.RouletteApi

class RouletteRepository(private val api: RouletteApi) {
    fun createOrUpdateRoulette(
        request: CreateOrUpdateRouletteRequest,
        token: String
    ) = api.createOrUpdateRoulette(
        request = request,
        authHeader = token
    )

    fun getRoulette(creatorId: Long, token: String) = api.getRoulette(
        creatorId = creatorId,
        authHeader = token
    )

    fun spinRoulette(request: SpinRouletteRequest, token: String) = api.spinRoulette(
        request = request,
        authHeader = token
    )

    fun refundRouletteDonation(roomId: Long, token: String): Single<ApiResponse<Any>> {
        return api.refundRouletteDonation(
            id = roomId,
            authHeader = token
        )
    }
}
