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

import com.its.api.its.model.dto.vms.TbVmsFontShpeDto;
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_FONT_SHPE")
public class TbVmsFontShpe implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS 글꼴 형태 코드")  // N NUMBER(3)
    @Id
    @Column(name = "VMS_FONT_SHPE_CD", nullable = false, columnDefinition = "NUMBER", length = 3)
    private Integer vmsFontShpeCd;

    @ApiModelProperty("VMS 글꼴 형태 명")  // Y VARCHAR(60)
    @Column(name = "VMS_FONT_SHPE_NM", length = 60)
    private String vmsFontShpeNm;

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

    public TbVmsFontShpeDto toDto() {
        TbVmsFontShpeDto dto = TbVmsFontShpeDto.builder()
                .vmsFontShpeCd(this.vmsFontShpeCd)
                .vmsFontShpeNm(this.vmsFontShpeNm)
                .build();

        dto.setVmsFontShpeDesc("[" + dto.getVmsFontShpeCd() + "] " + dto.getVmsFontShpeNm());
        return dto;
    }

}
