package com.kospo.talk.payload;

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

import java.time.LocalDateTime;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(name = "VManualDto", description = "동영상매뉴얼관리")
public class VManualDto {
    @Schema(name = "id", description = "주키")
    private Integer id;
    @Schema(name = "workId", description = "업무아이디")
    private String workId;
    @Schema(name = "sonm", description = "숏츠 논리명")
    private String sonm;
    @Schema(name = "svnm", description = "숏츠 물리명")
    private String svnm;
    @Schema(name = "onm", description = "논리명")
    private String onm;
    @Schema(name = "vnm", description = "물리명")
    private String vnm;
    @Schema(name = "path", description = "경로")
    private String path;
    @Schema(name = "insDate", description = "등록일")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSSSSS", timezone = "Asia/Seoul")
    private LocalDateTime insDate;
    @Schema(name = "deleteYn", description = "삭제여부")
    private Boolean deleteYn;
    @Schema(name = "size", description = "파일사이즈")
    private Integer size;
    @Schema(name = "sdata", description = "업로드 바이너리 데이터")
    private byte[] sdata;
    @Schema(name = "data", description = "업로드 바이너리 데이터")
    private byte[] data;

    public static VManualDto to(VManual manual) {
        return VManualDto.builder()
                .id(manual.getId())
                .workId(manual.getWorkId())
                .sonm(manual.getSonm())
                .svnm(manual.getSvnm())
                .onm(manual.getOnm())
                .vnm(manual.getVnm())
                .size(manual.getSize())
                .deleteYn(manual.getDeleteYn())
                .insDate(manual.getInsDate()).build();
    }
}
