package click.kamil.ultimate.web;

import lombok.RequiredArgsConstructor;
import org.springframework.statemachine.StateMachine;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@RestController
@RequestMapping("/api/ticket/reactive")
@RequiredArgsConstructor
public class ReactiveController {
    private final StateMachine<String, String> stateMachine;

    @PostMapping
    public Mono<Void> createReactive(@RequestBody String data) {
        return Mono.fromRunnable(() -> stateMachine.sendEvent("CREATE_REACTIVE"));
    }
}
