package com.kt.event.participation.infrastructure.kafka.event;

import com.kt.event.participation.domain.participant.Participant;
import lombok.*;

import java.time.LocalDateTime;

/**
 * 참여자 등록 Kafka 이벤트
 *
 * @author Digital Garage Team
 * @since 2025-01-24
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ParticipantRegisteredEvent {

    private String participantId;
    private String eventId;
    private String name;
    private String phoneNumber;
    private String channel;
    private Boolean storeVisited;
    private Integer bonusEntries;
    private LocalDateTime participatedAt;

    public static ParticipantRegisteredEvent from(Participant participant) {
        return ParticipantRegisteredEvent.builder()
            .participantId(participant.getParticipantId())
            .eventId(participant.getEventId())
            .name(participant.getName())
            .phoneNumber(participant.getPhoneNumber())
            .channel(participant.getChannel())
            .storeVisited(participant.getStoreVisited())
            .bonusEntries(participant.getBonusEntries())
            .participatedAt(participant.getCreatedAt())
            .build();
    }
}
