package com.its.vms.entity;

import com.its.vms.dto.TbVmsSymbLibDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *  Entity Class
 */
@Data
@Builder
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class TbVmsSymbLib implements Serializable {
    private static final long serialVersionUID = 1L;

    private Integer symbLibNmbr;
    private String rgstDt;
    private byte[] redData;
    private byte[] greenData;
    private String symbExpl;
    private byte[] imagData;
    private String vmsTypeCd;
    private String symbImagType;
    private String symbFileNm;
    private String symbType;
    private byte[] aviData;
    private Long imagSize;
    private Long playTm;
    private String delYn;
    private String updtDt;
    private Integer posX;
    private Integer posY;

    public TbVmsSymbLibDto toDto() {
        // 소통정보이미지 때문에 이미지번호에 "0" 을 추가하여 이미지번호로 사용함
        TbVmsSymbLibDto obj = TbVmsSymbLibDto.builder()
                .memSymbLibNmbr(this.symbLibNmbr+"0")
                .symbLibNmbr(this.symbLibNmbr)
                .rgstDt(this.rgstDt)
                .redData(this.redData)
                .greenData(this.greenData)
                .symbExpl(this.symbExpl)
                .imageData(this.imagData)
                .vmsTypeCd(this.vmsTypeCd)
                .symbImagType(this.symbImagType)
                .symbFileNm(this.symbFileNm)
                .symbType(this.symbType)
                .aviData(this.aviData)
                .imagSize(this.imagSize)
                .playTm(this.playTm)
                .delYn(this.delYn)
                .updtDt(this.updtDt)
                .posX(this.posX)
                .posY(this.posY)
                .gradSymbLibNmbrList(new ArrayList<>())
                .cellMap(new HashMap<>())
                .build();

        obj.setSymbInfo();

        return obj;
    }

}
