package click.kamil.examples.statemachine.layered.web;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/documents")
public class DocumentController {

    private final CommandGateway commandGateway;

    public DocumentController(CommandGateway commandGateway) {
        this.commandGateway = commandGateway;
    }

    @PostMapping("/submit")
    public void submit() {
        commandGateway.submitDocument();
    }

    @PostMapping("/approve")
    public void approve() {
        commandGateway.approveDocument();
    }

    @PostMapping("/reject")
    public void reject() {
        commandGateway.rejectDocument();
    }
}
