package click.kamil.ultimate.web;

import click.kamil.ultimate.model.TicketRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.statemachine.StateMachine;
import org.springframework.web.bind.annotation.*;

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

    @PostMapping("/create")
    public void createTicket(@RequestBody TicketRequest request) {
        stateMachine.sendEvent("CREATE");
    }

    @PostMapping("/{id}/assign")
    public void assignTicket(@PathVariable String id, @RequestParam String userId) {
        stateMachine.sendEvent("ASSIGN");
    }
}
