package com.brilliance.isc.bo.model;

import com.brilliance.isc.bo.Cbb;
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 Bdacbs extends AbstractCommonVo {

    private Cbb max;

    private Cbb max2;

    private Cbb opn1;

    private Cbb opn2;

    private Cbb opnbpdisc;

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