package com.yomahub.liteflow.test.useTTLInWhen.cmp;

import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.slot.DefaultContext;
import com.yomahub.liteflow.test.useTTLInWhen.TestTL;

@LiteflowComponent
public class CmpConfig {
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "a")
    public void processA(NodeComponent bindCmp) {
        TestTL.set("hello");
        System.out.println("ACmp executed!");    }

    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "b")
    public void processB(NodeComponent bindCmp) {
        String value = TestTL.get();
        DefaultContext context = bindCmp.getFirstContextBean();
        context.setData(bindCmp.getNodeId(),value+",b");
        System.out.println("BCmp executed!");

    }

    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "c")
    public void processC(NodeComponent bindCmp) {
        String value = TestTL.get();
        DefaultContext context = bindCmp.getFirstContextBean();
        context.setData(bindCmp.getNodeId(),value+",c");
        System.out.println("CCmp executed!");
    }




    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "d")
    public void processD(NodeComponent bindCmp) {
        String value = TestTL.get();
        DefaultContext context = bindCmp.getFirstContextBean();
        context.setData(bindCmp.getNodeId(),value+",d");
        System.out.println("DCmp executed!");
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "e")
    public void processE(NodeComponent bindCmp) {
        String value = TestTL.get();
        DefaultContext context = bindCmp.getFirstContextBean();
        context.setData(bindCmp.getNodeId(),value+",e");
        System.out.println("ECmp executed!");
    }
    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS,nodeId = "f")
    public void process(NodeComponent bindCmp) {
        String value = TestTL.get();
        DefaultContext context = bindCmp.getFirstContextBean();
        context.setData(bindCmp.getNodeId(),value+",f");
        System.out.println("FCmp executed!");
    }
}
