package com.unicorn.hgzero.meeting.infra.event.publisher;

import com.unicorn.hgzero.meeting.infra.event.dto.MeetingStartedEvent;
import com.unicorn.hgzero.meeting.infra.event.dto.MeetingEndedEvent;
import com.unicorn.hgzero.meeting.infra.event.dto.TodoAssignedEvent;
import com.unicorn.hgzero.meeting.infra.event.dto.NotificationRequestEvent;
import com.unicorn.hgzero.meeting.infra.event.dto.MinutesAnalysisRequestEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * No-Op EventPublisher 구현체
 * EventHub가 설정되지 않은 경우 사용되는 더미 구현체
 */
@Component
@Primary
@ConditionalOnMissingBean(name = "eventProducer")
@Slf4j
public class NoOpEventPublisher implements EventPublisher {

    @Override
    public void publishMeetingStarted(MeetingStartedEvent event) {
        log.debug("[NoOp] Meeting started event: {}", event.getMeetingId());
    }

    @Override
    public void publishMeetingEnded(MeetingEndedEvent event) {
        log.debug("[NoOp] Meeting ended event: {}", event.getMeetingId());
    }

    @Override
    public void publishTodoAssigned(TodoAssignedEvent event) {
        log.debug("[NoOp] Todo assigned event: {}", event.getTodoId());
    }

    @Override
    public void publishNotificationRequest(NotificationRequestEvent event) {
        log.debug("[NoOp] Notification request event: {}", event.getRecipientEmail());
    }

    @Override
    public void publishTodoAssigned(String todoId, String title, String assigneeId, String assigneeName,
                                   String assignedBy, String assignedByName, LocalDate dueDate) {
        log.debug("[NoOp] Todo assigned: todoId={}, title={}", todoId, title);
    }

    @Override
    public void publishTodoCompleted(String todoId, String title, String assigneeId, String assigneeName,
                                    String completedBy, String completedByName) {
        log.debug("[NoOp] Todo completed: todoId={}, title={}", todoId, title);
    }

    @Override
    public void publishMinutesFinalized(String minutesId, String title, String finalizedBy, String finalizedByName) {
        log.debug("[NoOp] Minutes finalized: minutesId={}, title={}", minutesId, title);
    }

    @Override
    public void publishMeetingCreated(String meetingId, String title, LocalDateTime startTime,
                                     String location, List<String> participants, String organizerId, String organizerName) {
        log.debug("[NoOp] Meeting created: meetingId={}, title={}, participants={}",
                meetingId, title, participants.size());
    }

    @Override
    public void publishMinutesAnalysisRequest(MinutesAnalysisRequestEvent event) {
        log.debug("[NoOp] Minutes analysis request event: minutesId={}", event.getMinutesId());
    }
}
