package com.oqpo.api.web.dto.response;

import com.oqpo.api.entity.oper.FileEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

@Getter
@Setter
@ToString
@Builder
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class FileResponse {
    @ApiModelProperty(value = "파일번호")
    private String fileNo;

    @ApiModelProperty(value = "파일순번")
    private Integer fileSeq;

    @ApiModelProperty(value = "파일초기명")
    private String fileOrgNm;

    @ApiModelProperty(value = "파일사이즈")
    private String fileSize;

    @ApiModelProperty(value = "파일경로")
    private String filePath;

    public static FileResponse toDTO(FileEntity entity) {
        if (entity == null) return null;
        return FileResponse.builder()
                .fileNo(entity.getFileNo())
                .fileSeq(entity.getFileSeq())
                .fileOrgNm(entity.getFileOrgNm())
                .fileSize(entity.getFileSize())
                .filePath(entity.getFilePath())
                .build();
    }
}
