package cn.stylefeng.workflow.event.modular.controller;

import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.workflow.event.api.EventPublishApi;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@ApiResource(name = "获取流程的执行类列表")
public class EventListController {

    @Resource
    private EventPublishApi eventPublishApi;

    @GetResource(name = "获取流程的执行类列表", path = "/modelEvent/listEventConsumers")
    public ResponseData<List<String>> listEventConsumers() {
        List<String> actionClasses = eventPublishApi.getActionClasses();
        return new SuccessResponseData<>(actionClasses);
    }

    @GetResource(name = "获取所有任务事件列表", path = "/taskEvent/listEventConsumers")
    public ResponseData<List<String>> taskEventConsumers() {
        List<String> actionClasses = eventPublishApi.getTaskActionClasses();
        return new SuccessResponseData<>(actionClasses);
    }

}
