package com.its.api.its.model.entity.vms;

import com.its.api.its.model.dto.vms.TbVmsFormBckghueDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * VMS FORM 배경색상 Entity Class
 */
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("VMS FORM 배경색상")
@Entity
@Table(name = "TB_VMS_FORM_BCKGHUE")
public class TbVmsFormBckghue implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS FORM 배경 색상 코드")  // N NUMBER(10)
    @Id
    @Column(name = "VMS_FORM_BCKG_HUE_CD", nullable = false, columnDefinition = "NUMBER", length = 10)
    private Long vmsFormBckgHueCd;

    @ApiModelProperty("VMS FORM 배경 색상 명")  // Y VARCHAR(60)
    @Column(name = "VMS_FORM_BCKG_HUE_NM", length = 60)
    private String vmsFormBckgHueNm;

    @ApiModelProperty("편집 코드")  // Y VARCHAR(7)
    @Column(name = "EDTN_CD", length = 7)
    private String edtnCd;

    public TbVmsFormBckghueDto toDto() {
        return TbVmsFormBckghueDto.builder()
                .vmsFormBckgHueCd(this.vmsFormBckgHueCd)
                .vmsFormBckgHueNm(this.vmsFormBckgHueNm)
                .edtnCd(this.edtnCd)
                .build();
    }

    public TbVmsFormBckghue(Long vmsFormBckgHueCd) {
        this.vmsFormBckgHueCd = vmsFormBckgHueCd;
    }

    public void updateInfo(TbVmsFormBckghueDto.TbVmsFormBckghueUpdReq req) {
        this.vmsFormBckgHueNm = req.getVmsFormBckgHueNm();
        this.edtnCd = req.getEdtnCd();
    }

}
