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

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
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.api.entity.log.FlowEngineLog;
import cn.stylefeng.workflow.log.modular.pojo.request.FlowEngineLogRequest;
import cn.stylefeng.workflow.log.modular.service.FlowEngineLogService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@ApiResource(name = "流程流转的日志")
public class FlowEngineLogController {

    @Resource
    private FlowEngineLogService flowEngineLogService;

    @GetResource(name = "流程流转的日志-获取列表", path = "/flowEngineLog/list")
    public ResponseData<List<FlowEngineLog>> list(FlowEngineLogRequest flowEngineLogRequest) {
        return new SuccessResponseData<>(flowEngineLogService.findList(flowEngineLogRequest));
    }

    @GetResource(name = "流程流转的日志-分页查询", path = "/flowEngineLog/page")
    public ResponseData<PageResult<FlowEngineLog>> page(FlowEngineLogRequest flowEngineLogRequest) {
        return new SuccessResponseData<>(flowEngineLogService.findPage(flowEngineLogRequest));
    }

    @GetResource(name = "获取节点的日志列表", path = "/flowEngineLog/nodeLogList")
    public ResponseData<List<FlowEngineLog>> nodeLogList(FlowEngineLogRequest flowEngineLogRequest) {
        return new SuccessResponseData<>(flowEngineLogService.nodeLogList(flowEngineLogRequest));
    }

}
