package click.kamil.ultimate.api;

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import lombok.RequiredArgsConstructor;
import org.springframework.statemachine.StateMachine;
import org.springframework.stereotype.Component;

@Path("/jaxrs/ticket")
@Component
@RequiredArgsConstructor
public class JerseyResource {
    private final StateMachine<String, String> stateMachine;

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    public void createJaxRs(String payload) {
        stateMachine.sendEvent("CREATE_JAXRS");
    }

    @PUT
    @Path("/{id}/resolve")
    public void resolve(@PathParam("id") String id) {
        stateMachine.sendEvent("RESOLVE");
    }
}
