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

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

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

    @ApiModelProperty("PROCESSID")  // N NUMBER(6)
    @Column(name = "PROCESSID", nullable = false, columnDefinition = "NUMBER", length = 6)
    @Id
    private Integer processid;

    @ApiModelProperty("PROCESSSTATEKIND")  // N CHAR(1)
    @Column(name = "PROCESSSTATEKIND", nullable = false, columnDefinition = "CHAR", length = 1)
    private String processstatekind;

    @ApiModelProperty("")  // N DATE(0)
    @Column(name = "COLLECTDATE", nullable = false)
    private LocalDateTime collectdate;

    @ApiModelProperty("")  // N TIMESTAMP(6)(0)
    @Column(name = "COLLECTTIMESTAMP", nullable = false)
    private LocalDateTime collecttimestamp;

    @ApiModelProperty("")  // Y CHAR(1)
    @Column(name = "PROCESSSTATUS", columnDefinition = "CHAR", length = 1)
    private String processstatus;

    public BisProcessStatusHistoryDto toDto() {
        return BisProcessStatusHistoryDto.builder()
                .collectdate(this.collectdate)
                .collecttimestamp(this.collecttimestamp)
                .processid(this.processid)
                .processstatekind(this.processstatekind)
                .processstatus(this.processstatus)
                .build();
    }

}
