package com.nisemoe.nise.controller

import com.nisemoe.nise.UserReplayData
import com.nisemoe.nise.database.UserScoreService
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RestController
import java.util.UUID

@RestController
class UserScoresController(
    private val userScoreService: UserScoreService
) {

    @GetMapping("user-score/{replayId}")
    fun getScoreDetails(@PathVariable replayId: UUID): ResponseEntity<UserReplayData> {
        val replayData = this.userScoreService.getReplayData(replayId)
            ?: return ResponseEntity.notFound().build()

        return ResponseEntity.ok(replayData)
    }

}