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

import com.its.api.its.model.dto.vms.TbVmsMsgDsplDrctDto;
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 메시지 표출 방향 Entity Class
 */
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("VMS 메시지 표출 방향")
@Entity
@Table(name = "TB_VMS_MSG_DSPL_DRCT")
public class TbVmsMsgDsplDrct implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS 메시지 표출 방향 코드")  // N NUMBER(3)
    @Id
    @Column(name = "VMS_MSG_DSPL_DRCT_CD", nullable = false, columnDefinition = "NUMBER", length = 3)
    private Integer vmsMsgDsplDrctCd;

    @ApiModelProperty("VMS 메시지 표출 방향 명")  // Y VARCHAR(60)
    @Column(name = "VMS_MSG_DSPL_DRCT_NM", length = 60)
    private String vmsMsgDsplDrctNm;

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

    @ApiModelProperty("표출 방법 설명")  // Y VARCHAR(200)
    @Column(name = "DSPL_MTHD_EXPL", length = 200)
    private String dsplMthdExpl;

    public TbVmsMsgDsplDrctDto toDto() {
        TbVmsMsgDsplDrctDto dto = TbVmsMsgDsplDrctDto.builder()
                .vmsMsgDsplDrctCd(this.vmsMsgDsplDrctCd)
                .vmsMsgDsplDrctNm(this.vmsMsgDsplDrctNm)
                .dsplMthdExpl(this.dsplMthdExpl)
                .build();

        dto.setVmsMsgDsplDrctDesc("[" + dto.getVmsMsgDsplDrctCd() + "] " + dto.getVmsMsgDsplDrctNm());
        return dto;
    }


}
