package com.its.op.entity.its.rse;

import com.its.op.dto.its.rse.TbRseObuNonCrptDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * RSE OBU NON CRPT Entity Class
 */
@Getter
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("RSE OBU NON CRPT")
@Entity
@Table(name = "TB_RSE_OBU_NON_CRPT")
public class TbRseObuNonCrpt implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("OBU 아이디")  // N VARCHAR2(200)
    @Id
    @Column(name = "OBU_ID", nullable = false, length = 200)
    private String obuId;

    @ApiModelProperty("OBU 인식 번호")  // N VARCHAR2(200)
    @Column(name = "OBU_IDNT_NMBR", nullable = false, length = 200)
    private String obuIdntNmbr;

    public TbRseObuNonCrptDto toDto() {
        return TbRseObuNonCrptDto.builder()
                .obuId(this.obuId)
                .obuIdntNmbr(this.obuIdntNmbr)
                .build();
    }

    public TbRseObuNonCrpt(String obuId) {
        this.obuId = obuId;
    }

    public void updateInfo(TbRseObuNonCrptDto.TbRseObuNonCrptUpdReq req) {
        this.obuIdntNmbr = req.getObuIdntNmbr();
    }

}
