package cn.stylefeng.team.project.modular.filing.controller;

import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.team.project.modular.filing.pojo.aidesign.aiparse.ParseToBusinessRequest;
import cn.stylefeng.team.project.modular.filing.pojo.flux.FluxResponse;
import cn.stylefeng.team.project.modular.filing.service.AIDesignProcessService;
import jakarta.annotation.Resource;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@ApiResource(name = "AI分析图片的过程")
public class AiDesignProcessController {

    @Resource
    private AIDesignProcessService aiDesignProcessService;

    @PostResource(name = "AI解析图片，转化为业务数据", path = "/aiBusinessDesign/parseToBusinessFlux", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
    public Flux<FluxResponse> parseToBusinessFlux(@RequestBody @Validated ParseToBusinessRequest parseToBusinessRequest) {
        return aiDesignProcessService.parseToBusinessFlux(parseToBusinessRequest);
    }

}
