package com.its.vds.dto;

import com.its.vds.entity.TbVdsDtctClct;
import lombok.*;

import java.io.Serializable;

/**
 *  Entity Class
 */
@Getter
@Setter
@Builder
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class TbVdsDtctClctDto implements Serializable {
    private static final long serialVersionUID = 1L;

    private String clctDt;
    private Long vdsDtctNmbr;
    private Integer trafClctCycl;
    private Integer tfvl;
    private Integer sTfvl;
    private Integer mTfvl;
    private Integer lTfvl;
    private Integer sped;
    private Double avrgOcpyRate;
    private Integer avrgLngt;
    private Integer hdwy;
    private Double spceOcpyRate;
    private Integer spceAvrgSped;
    private boolean isValid;

    public void initVal() {
        this.trafClctCycl = 0;
        this.tfvl         = 0;
        this.sTfvl        = 0;
        this.mTfvl        = 0;
        this.lTfvl        = 0;
        this.sped         = 0;
        this.avrgOcpyRate = 0.;
        this.avrgLngt     = 0;
        this.hdwy         = 0;
        this.spceOcpyRate = 0.;
        this.spceAvrgSped = 0;
        this.isValid      = false;
    }

    public TbVdsDtctClct toEntity() {
        return TbVdsDtctClct.builder()
                .clctDt(this.clctDt)
                .vdsDtctNmbr(this.vdsDtctNmbr)
                .trafClctCycl(this.trafClctCycl)
                .tfvl(this.tfvl)
                .sTfvl(this.sTfvl)
                .mTfvl(this.mTfvl)
                .lTfvl(this.lTfvl)
                .sped(this.sped)
                .avrgOcpyRate(this.avrgOcpyRate)
                .avrgLngt(this.avrgLngt)
                .hdwy(this.hdwy)
                .spceOcpyRate(this.spceOcpyRate)
                .spceAvrgSped(this.spceAvrgSped)
                .build();
    }

}
