package com.zioinfo.kintex.module.m5;

import com.zioinfo.kintex.module.m5.dto.RenderJobDto;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

/**
 * RenderJob 완료/실패를 STOMP 토픽으로 푸시한다(design.md §1-4 — 생성 완료 시 WebSocket 교체).
 * 구독 토픽: {@code /topic/render/{jobId}}.
 */
@Service
public class RenderNotificationService {

    private final SimpMessagingTemplate messaging;

    public RenderNotificationService(SimpMessagingTemplate messaging) {
        this.messaging = messaging;
    }

    public void pushJobUpdate(RenderJobDto job) {
        messaging.convertAndSend("/topic/render/" + job.jobId(), job);
    }
}
