package click.kamil.examples.enterprise.service;

import click.kamil.examples.enterprise.constants.OrderEvents;
import lombok.RequiredArgsConstructor;
import org.springframework.statemachine.StateMachine;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class OrderServiceImpl implements OrderService {

    private final StateMachine<String, String> stateMachine;

    @Override
    public void place() {
        stateMachine.sendEvent(OrderEvents.PLACE);
    }

    @Override
    public void cancel(String id) {
        stateMachine.sendEvent(OrderEvents.CANCEL);
    }
}
