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

import com.its.api.its.model.dto.view.VwFcltSttsCntDto;
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;

/**
 *  Entity Class
 */
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("시설물현황")
@Entity
@Table(name = "VW_FCLT_STTS_CNT")
public class VwFcltSttsCnt implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("시설물유형")  // Y VARCHAR(4)
    @Id
    @Column(name = "FCLT_TYPE", length = 4)
    private String fcltType;

    @ApiModelProperty("시설물명")  // Y VARCHAR(100)
    @Column(name = "FCLT_NM", length = 100)
    private String fcltNm;

    @ApiModelProperty("전체개수")  // Y NUMBER(0)
    @Column(name = "TOTAL_CNT", columnDefinition = "NUMBER", length = 3)
    private Integer totalCnt;

    @ApiModelProperty("정상개수")  // Y NUMBER(0)
    @Column(name = "NORMAL_CNT", columnDefinition = "NUMBER", length = 3)
    private Integer normalCnt;

    @ApiModelProperty("오류개수")  // Y NUMBER(0)
    @Column(name = "ERROR_CNT", columnDefinition = "NUMBER", length = 3)
    private Integer errorCnt;

    public VwFcltSttsCntDto toDto() {
        return VwFcltSttsCntDto.builder()
                .fcltType(this.fcltType)
                .fcltNm(this.fcltNm)
                .totalCnt(this.totalCnt)
                .normalCnt(this.normalCnt)
                .errorCnt(this.errorCnt)
                .build();
    }

}
