package com.its.vms.entity;

import com.its.app.utils.ImageUtils;
import com.its.vms.dto.TbVmsFormColrDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

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

    private Integer vmsFormColrCd;
    private String vmsFormColrNm;
    private Long vmsFormColrVal;

    public TbVmsFormColrDto toDto() {
        return TbVmsFormColrDto.builder()
                .vmsFormColrCd(this.vmsFormColrCd)
                .vmsFormColrNm(this.vmsFormColrNm)
                //.vmsFormColor(new Color(this.vmsFormColrVal & 0xFF, (this.vmsFormColrVal & 0xFF00) >> 8, (this.vmsFormColrVal & 0xFF0000) >> 16))
                .vmsFormColor(ImageUtils.getRGB(this.vmsFormColrVal.intValue()))
                .build();
    }
}
