package com.its.op.entity.its.unit;

import com.its.op.dto.its.unit.TbUnitSystSttsHsHistDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 단위 시스템 상태 이력 Entity Class
 */
@Getter
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("단위 시스템 상태 이력")
@Entity
@Table(name = "TB_UNIT_SYST_STTS_HS")
@IdClass(TbUnitSystSttsHsKey.class)
public class TbUnitSystSttsHs implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("시스템 ID")  // N VARCHAR(30)
    @Id
    @Column(name = "SYST_ID", nullable = false, length = 30)
    private String systId;

    @ApiModelProperty("생성 일시")  // N VARCHAR(14)
    @Id
    @Column(name = "CRTN_DT", nullable = false, length = 14)
    private String crtnDt;

    @ApiModelProperty("시스템 상태 코드")  // Y VARCHAR(7)
    @Column(name = "SYST_STTS_CD", length = 7)
    private String systSttsCd;

    public TbUnitSystSttsHsHistDto toDto() {
        return TbUnitSystSttsHsHistDto.builder()
                .systId(this.systId)
                .crtnDt(this.crtnDt)
                .systSttsCd(this.systSttsCd)
                .build();
    }

}
