package com.kospo.talk.payload;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.kospo.talk.model.WorkLogo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.time.LocalDateTime;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(name = "WorkLogoDto", description = "업무로고관리")
public class WorkLogoDto {
    @Schema(name = "workId", description = "업무아이디")
    private String workId;
    @Schema(name = "onm", description = "논리명")
    private String onm;
    @Schema(name = "vnm", description = "물리명")
    private String vnm;
    @Schema(name = "path", description = "경로")
    private String path;
    @Schema(name = "type", description = "파일 종류")
    private String type;
    @Schema(name = "size", description = "파일 용량")
    private long size;
    @Schema(name = "insDate", description = "등록일시")
    private LocalDateTime insDate;
    @Schema(name = "data", description = "base64 데이터")
    private byte[] data;

    public static WorkLogoDto to(WorkLogo workLogo) {
        return WorkLogoDto.builder()
                .workId(workLogo.getWorkId())
                .vnm(workLogo.getVnm())
                .onm(workLogo.getOnm())
                .path(workLogo.getPath())
                .type(workLogo.getType())
                .size(workLogo.getSize())
                .insDate(workLogo.getInsDate()).build();
    }
}
