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;

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

    @PostMapping("/webhook")
    public void onSnsMessage(@RequestBody String message) {
        // In a real app, you'd verify the SNS signature and handle SubscriptionConfirmation
        stateMachine.sendEvent("SNS_UPDATE");
    }
}
