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

import com.its.op.dto.its.rse.TbRseOffrSectTrafDto;
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.*;
import java.io.Serializable;

/**
 * RSE 제공 정보 Entity Class
 */
@Getter
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("RSE 제공 정보")
@Entity
@Table(name = "TB_RSE_OFFR_SECT_TRAF")
@IdClass(TbRseOffrSectTrafKey.class)
public class TbRseOffrSectTraf implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("제공 구간 아이디")  // N NUMBER(10)
    @Id
    @Column(name = "OFFR_SECT_ID", nullable = false, columnDefinition = "NUMBER", length = 10)
    private Long offrSectId;

    @ApiModelProperty("제공 일시")  // N VARCHAR2(14)
    @Id
    @Column(name = "PRCN_DT", nullable = false, length = 14)
    private String prcnDt;

    @ApiModelProperty("제공 내용")  // Y VARCHAR2(100)
    @Column(name = "OFFR_CONT", length = 100)
    private String offrCont;

    public TbRseOffrSectTrafDto toDto() {
        return TbRseOffrSectTrafDto.builder()
                .offrSectId(this.offrSectId)
                .prcnDt(this.prcnDt)
                .offrCont(this.offrCont)
                .build();
    }

    public TbRseOffrSectTraf(Long offrSectId, String prcnDt) {
        this.offrSectId = offrSectId;
        this.prcnDt = prcnDt;
    }

}
