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

import com.its.api.utis.model.dto.RseopstateDto;
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;
import java.time.LocalDateTime;

/**
 * RSE운영상태정보 Entity Class
 */
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("RSE운영상태정보")
@Entity
@Table(name = "RSEOPSTATE")
public class Rseopstate implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("RSEID")  // N VARCHAR(16)
    @Id
    @Column(name = "RSEID", nullable = false, length = 16)
    private String rseid;

    @ApiModelProperty("펌웨어버젼")  // Y VARCHAR(18)
    @Column(name = "FIRMVER", length = 18)
    private String firmver;

    @ApiModelProperty("맵버젼")  // Y VARCHAR(9)
    @Column(name = "MAPVER", length = 9)
    private String mapver;

    @ApiModelProperty("RSE부팅이후경과시간")  // Y NUMBER(10)
    @Column(name = "PASSTM", columnDefinition = "NUMBER", length = 10)
    private Long passtm;

    @ApiModelProperty("최근상태정보전송이후경과시간")  // Y NUMBER(10)
    @Column(name = "STPASSTM", columnDefinition = "NUMBER", length = 10)
    private Long stpasstm;

    @ApiModelProperty("가용메모리용량")  // Y NUMBER(10)
    @Column(name = "USEMEM", columnDefinition = "NUMBER", length = 10)
    private Long usemem;

    @ApiModelProperty("OBE접속대수")  // Y NUMBER(10)
    @Column(name = "OBECONCNT", columnDefinition = "NUMBER", length = 10)
    private Long obeconcnt;

    @ApiModelProperty("OBE접속실패대수1")  // Y NUMBER(10)
    @Column(name = "OBECONFAILCNT1", columnDefinition = "NUMBER", length = 10)
    private Long obeconfailcnt1;

    @ApiModelProperty("OBE접속실패대수2")  // Y NUMBER(10)
    @Column(name = "OBECONFAILCNT2", columnDefinition = "NUMBER", length = 10)
    private Long obeconfailcnt2;

    @ApiModelProperty("전체다중전송량")  // Y NUMBER(10)
    @Column(name = "MULTIQTY", columnDefinition = "NUMBER", length = 10)
    private Long multiqty;

    @ApiModelProperty("교통정보량")  // Y NUMBER(10)
    @Column(name = "TRAFFICQTY", columnDefinition = "NUMBER", length = 10)
    private Long trafficqty;

    @ApiModelProperty("수집정보 업로드량")  // Y NUMBER(10)
    @Column(name = "UPQTY", columnDefinition = "NUMBER", length = 10)
    private Long upqty;

    @ApiModelProperty("비OBE접속시도회수")  // Y NUMBER(10)
    @Column(name = "NONOBECONCNT", columnDefinition = "NUMBER", length = 10)
    private Long nonobeconcnt;

    @ApiModelProperty("수집시간")  // Y DATE(0)
    @Column(name = "COLLDT", length = 0)
    private LocalDateTime colldt;

    public RseopstateDto toDto() {
        return RseopstateDto.builder()
                .rseid(this.rseid)
                .firmver(this.firmver)
                .mapver(this.mapver)
                .passtm(this.passtm)
                .stpasstm(this.stpasstm)
                .usemem(this.usemem)
                .obeconcnt(this.obeconcnt)
                .obeconfailcnt1(this.obeconfailcnt1)
                .obeconfailcnt2(this.obeconfailcnt2)
                .multiqty(this.multiqty)
                .trafficqty(this.trafficqty)
                .upqty(this.upqty)
                .nonobeconcnt(this.nonobeconcnt)
                //.colldt(this.colldt)
                .build();
    }

}
