package com.sino.mci.channel.controller;

import com.sino.mci.channel.dto.ChannelAccountEventRequest;
import com.sino.mci.channel.service.ChannelAccountEventService;
import com.sino.mci.shared.web.ApiResponse;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
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/v1/channel-account")
@RequiredArgsConstructor
public class ChannelAccountEventController {

    private final ChannelAccountEventService eventService;

    @PostMapping("/event")
    public ApiResponse<?> receiveEvent(@Valid @RequestBody ChannelAccountEventRequest request) {
        eventService.handleEvent(request);
        return ApiResponse.ok(null);
    }
}
