package org.bdware.sc.bean;

import com.google.gson.JsonElement;
import org.bdware.sc.node.AnnotationNode;
import org.bdware.sc.node.ContractNode;
import org.bdware.sc.util.JsonUtil;

import java.io.Serializable;

public class JoinInfo implements Serializable {
    public String joinRule;
    public JsonElement joinCount;

    public static JoinInfo create(AnnotationNode annotationNode, ContractNode contractNode) {
        JoinInfo info = new JoinInfo();
        info.joinRule = null;
        if (annotationNode.getArgs().size() == 1) {
            String str = annotationNode.getArgs().get(0);
            info = JsonUtil.fromJson(str, JoinInfo.class);
        }
        System.out.println("[JoinInfo] annotationNode:" + JsonUtil.toJson(annotationNode));
        return info;
    }
}
