package com.kt.event.content.biz.dto;

import com.kt.event.content.biz.domain.GeneratedImage;
import com.kt.event.content.biz.domain.ImageStyle;
import com.kt.event.content.biz.domain.Platform;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

import java.time.LocalDateTime;

/**
 * 이미지 정보 DTO
 */
@Getter
@Builder
@AllArgsConstructor
public class ImageInfo {

    private Long id;
    private String eventId;
    private ImageStyle style;
    private Platform platform;
    private String cdnUrl;
    private String prompt;
    private boolean selected;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

    /**
     * 도메인 모델로부터 생성
     *
     * @param image 이미지 도메인 모델
     * @return ImageInfo
     */
    public static ImageInfo from(GeneratedImage image) {
        return ImageInfo.builder()
                .id(image.getId())
                .eventId(image.getEventId())
                .style(image.getStyle())
                .platform(image.getPlatform())
                .cdnUrl(image.getCdnUrl())
                .prompt(image.getPrompt())
                .selected(image.isSelected())
                .createdAt(image.getCreatedAt())
                .updatedAt(image.getUpdatedAt())
                .build();
    }
}
