package com.kt.event.participation.domain.draw;

import com.kt.event.common.entity.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.*;

/**
 * 당첨자 추첨 로그 엔티티
 * 추첨 이력 관리 및 재추첨 방지
 *
 * @author Digital Garage Team
 * @since 2025-01-24
 */
@Entity
@Table(name = "draw_logs",
    indexes = {
        @Index(name = "idx_draw_log_event_id", columnList = "event_id")
    }
)
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class DrawLog extends BaseTimeEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 이벤트 ID
     */
    @Column(name = "event_id", nullable = false, length = 50)
    private String eventId;

    /**
     * 전체 참여자 수
     */
    @Column(name = "total_participants", nullable = false)
    private Integer totalParticipants;

    /**
     * 당첨자 수
     */
    @Column(name = "winner_count", nullable = false)
    private Integer winnerCount;

    /**
     * 매장 방문 보너스 적용 여부
     */
    @Column(name = "apply_store_visit_bonus", nullable = false)
    private Boolean applyStoreVisitBonus;

    /**
     * 추첨 알고리즘
     */
    @Column(name = "algorithm", nullable = false, length = 50)
    private String algorithm;

    /**
     * 추첨 일시
     */
    @Column(name = "drawn_at", nullable = false)
    private java.time.LocalDateTime drawnAt;

    /**
     * 추첨 실행자 ID (관리자 또는 시스템)
     */
    @Column(name = "drawn_by", length = 50)
    private String drawnBy;
}
