package com.brilliance.isc.vo.model;

import com.brilliance.isc.common.vo.AbstractCommonVo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.lang.reflect.Field;
import java.util.Map;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class DiacbsVo extends AbstractCommonVo {

    private CbbVo max;

    private CbbVo nom1;

    private CbbVo max2;

    private CbbVo opn1;

    private CbbVo opn2;

    @Override
    public void reset() {
        if (max == null) {
            max = new CbbVo();
        }
        if (nom1 == null) {
            nom1 = new CbbVo();
        }
        if (max2 == null) {
            max2 = new CbbVo();
        }
        if (opn1 == null) {
            opn1 = new CbbVo();
        }
        if (opn2 == null) {
            opn2 = new CbbVo();
        }
    }
    public void fillToMap(Map<String,CbbVo> cbsMap){
        for (Field field : this.getClass().getDeclaredFields()) {
            if(CbbVo.class == field.getType()){
                field.setAccessible(true);
                CbbVo CbbVo = null;
                try {
                    CbbVo = (CbbVo)field.get(this);
                } catch (IllegalAccessException e) {
                }
                if(CbbVo != null){
                    cbsMap.put(field.getName().toUpperCase(),CbbVo);
                }
            }
        }
    }
}
