package com.hdkj.lt.bf.controller;

import com.hdkj.lt.bf.entity.dto.CartoonDataQueryDTO;
import com.hdkj.lt.bf.entity.dto.DirectCurrentDTO;
import com.hdkj.lt.bf.entity.vo.DirectCurrentDataVO;
import com.hdkj.lt.bf.entity.vo.ShowCartoonDataVO;
import com.hdkj.lt.bf.service.ShowCartoonService;
import com.hdkj.hussar.ApiResponse;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @Description:
 * @Author: wenhao
 * @Create: 2025/07/09 19:26
 * @Version: 1.0
 */
@Validated
@RestController
@RequestMapping("/showCartoon")
@RequiredArgsConstructor
public class ShowCartoonController {

    private final ShowCartoonService showCartoonService;

    /**
     * 生成方案反演数据
     *
     * @param objId
     * @param objType
     * @return
     */
    @GetMapping("/generateCartoonData")
    @ApiOperation(value = "生成方案反演数据")
    public <T> ApiResponse<T> generateCartoonData(@NotNull(message = "objId不能为空") Long objId, @NotBlank(message = "objType不能为空") String objType) {
        showCartoonService.generateCartoonData(objId, objType);
        return ApiResponse.success();
    }

    /**
     * 查询动画演示数据
     *
     * @param queryDTO
     * @return
     */
    @GetMapping("/getCartoonData")
    @ApiOperation(value = "查询动画演示数据")
    public ApiResponse<ShowCartoonDataVO> getCartoonData(@Valid CartoonDataQueryDTO queryDTO) {
        return ApiResponse.success(showCartoonService.getCartoonData(queryDTO));
    }

    /**
     * 查询朝流数据信息
     */
    @PostMapping("/getDirectCurrentData")
    @ApiOperation(value = "查询朝流数据信息")
    public ApiResponse<List<DirectCurrentDataVO>> getDirectCurrentData(@Valid @RequestBody DirectCurrentDTO queryDTO) {
        return ApiResponse.success(showCartoonService.getDirectCurrentData(queryDTO));
    }

}
