package cn.stylefeng.team.project.modular.businessrender.contoller;

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.team.project.api.pojo.BusinessSearchRequest;
import cn.stylefeng.team.project.modular.businessrender.pojo.response.BusinessRenderConfigVo;
import cn.stylefeng.team.project.modular.businessrender.service.BusinessRenderConfigService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@ApiResource(name = "业务渲染的配置")
public class BusinessRenderConfigController {

    @Resource
    private BusinessRenderConfigService businessRenderConfigService;

    @GetResource(name = "获取业务渲染的配置", path = "/businessRenderConfig/getConfig")
    public ResponseData<BusinessRenderConfigVo> getConfig(@Validated BusinessSearchRequest businessRequest) {
        return new SuccessResponseData<>(businessRenderConfigService.getConfig(businessRequest));
    }

    @GetResource(name = "获取视图的自定义渲染接口列表", path = "/businessRenderConfig/getCustomRenderApiList")
    public ResponseData<List<String>> getCustomRenderApiList() {
        List<String> customRenderApiList = businessRenderConfigService.getCustomRenderApiList();
        return new SuccessResponseData<>(customRenderApiList);
    }

}
