package com.its.vms.entity;

import com.its.vms.dto.TbVmsRltnIfscDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 *  Entity Class
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TbVmsRltnIfsc 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 TbVmsRltnIfscDto toDto() {
        return TbVmsRltnIfscDto.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(TbVmsRltnIfscDto rltnIfsc) {
        rltnIfsc.setDsplPrrt(this.dsplPrrt);
        rltnIfsc.setAxisYn(this.axisYn);
        rltnIfsc.setCngstSped(this.cngstSped);
        rltnIfsc.setCngstCnfmYn("Y".equals(this.cngstCnfmYn));
        rltnIfsc.setCngstCnfmSped(this.cngstCnfmSped);
    }
}
