package com.its.vms.dto;

import com.its.vms.entity.TbVmsRltnIfsc;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;

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

    private Long vmsCtlrNmbr;
    private Long vmsIfscId;
    private Integer dsplPrrt;
    private String axisYn;
    private Integer cngstSped;
    private Integer cngstCnfmSped;
    private String cngstCnfmYn;

    public TbVmsRltnIfsc toEntity() {
        return TbVmsRltnIfsc.builder()
                .vmsCtlrNmbr(this.vmsCtlrNmbr)
                .vmsIfscId(this.vmsIfscId)
                .dsplPrrt(this.dsplPrrt)
                .axisYn(this.axisYn)
                .cngstSped(this.cngstSped)
                .cngstCnfmYn("Y".equals(this.cngstCnfmYn))
                .cngstCnfmSped(this.cngstCnfmSped)
                .isUsed(true)
                .cngstCnt(0)
                .cngstDt("")
                .build();
    }

    public void rltnIfscCopy(TbVmsRltnIfsc rltnIfsc) {
        rltnIfsc.setDsplPrrt(this.dsplPrrt);
        rltnIfsc.setAxisYn(this.axisYn);
        rltnIfsc.setCngstSped(this.cngstSped);
        rltnIfsc.setCngstCnfmYn("Y".equals(this.cngstCnfmYn));
        rltnIfsc.setCngstCnfmSped(this.cngstCnfmSped);
    }
}
