package dev.usbharu.hideout.activitypub.interfaces.api

import dev.usbharu.activitystreamsserialization.other.JsonLd
import dev.usbharu.hideout.activitypub.application.actor.GetActorApplicationService
import dev.usbharu.hideout.core.domain.model.support.principal.Anonymous
import org.springframework.http.ResponseEntity
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable

@Controller
class APActorController(private val getActorApplicationService: GetActorApplicationService) {
    @GetMapping(
        "/users/{username}",
//        consumes = ["application/activity+json"],
        produces = ["application/activity+json"]
    )
    suspend fun user(@PathVariable username: String): ResponseEntity<JsonLd> =
        ResponseEntity.ok(getActorApplicationService.execute(username, Anonymous))
}
