package com.its.op.entity.its.vms;

import com.its.op.dto.its.vms.TbVmsFontNameDto;
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_NAME")
public class TbVmsFontName implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS 글꼴 명칭 코드")  // N NUMBER(3)
    @Id
    @Column(name = "VMS_FONT_NAME_CD", nullable = false, columnDefinition = "NUMBER", length = 3)
    private Integer vmsFontNameCd;

    @ApiModelProperty("VMS 글꼴 명칭")  // Y VARCHAR(60)
    @Column(name = "VMS_FONT_NAME_NM", length = 60)
    private String vmsFontName;

    @ApiModelProperty("사용 여부")  // Y CHAR(1)
    @Column(name = "USE_YN", columnDefinition = "CHAR", length = 1)
    private String useYn;

    public TbVmsFontNameDto toDto() {
        TbVmsFontNameDto dto = TbVmsFontNameDto.builder()
                .vmsFontNameCd(this.vmsFontNameCd)
                .vmsFontName(this.vmsFontName)
                .useYn(this.useYn)
                .build();

        dto.setVmsFontNameDesc("[" + dto.getVmsFontNameCd() + "] " + dto.getVmsFontName());
        return dto;
    }

}
