package com.brilliance.isc.vo.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 Gcacbs extends AbstractCommonVo {

    private Cbb max;


    private Cbb opn1;


    private Cbb max2;


    private Cbb opn2;


    private Cbb maxint;


    private Cbb opnint;

    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);
                }
            }
        }
    }

    public void reset() {
        if (max == null) {
            max = new Cbb();
        }
        if (opn1 == null) {
            opn1 = new Cbb();
        }
        if (max2 == null) {
            max2 = new Cbb();
        }
        if (opn2 == null) {
            opn2 = new Cbb();
        }
        if (opnint == null) {
            opnint = new Cbb();
        }
        if (maxint == null) {
            maxint = new Cbb();
        }
    }
}
