package com.huatek.busi.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.huatek.busi.entity.AlgorithmBasicData;
import com.huatek.busi.service.AlgorithmBasicDataService;
import com.huatek.busi.vo.BusiEqmWarningVo;
import com.huatek.busi.where.AlgorithmBasicDataSelectVo;
import com.huatek.torch.frame.tools.ConstantUtil;
import com.huatek.torch.frame.tools.ResultUtil;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@Slf4j
@Api(tags={"算法管理接口"})
@RestController
@RequestMapping("/api/algorithmBasicData")
public class AlgorithmBasicDataController {

    @Reference(check = false)
    AlgorithmBasicDataService algorithmBasicDataService;

    @ApiOperation(value = "查询算法及所有节点", httpMethod = "POST", notes= "查询算法及所有节点", produces = "application/json;charset=utf-8", response=Map.class)
    @PostMapping(value = "/findTree", produces = { "application/json;charset=utf-8"})
    public Map<String, Object> findTree(@RequestBody AlgorithmBasicDataSelectVo algorithmBasicDataSelectVo) {
        return algorithmBasicDataService.findTree(algorithmBasicDataSelectVo);
    }

    @ApiOperation(value = "新增或修改算法信息", httpMethod = "POST", notes= "新增或修改算法信息", produces = "application/json;charset=utf-8", response=Map.class)
    @PostMapping(value = "/saveOrUpdate", produces = { "application/json;charset=utf-8"})
    public Map<String, Object> saveOrUpdate(@RequestHeader("token") String token, @RequestBody AlgorithmBasicData algorithmBasicData) {
        return algorithmBasicDataService.saveOrUpdate(token, algorithmBasicData);
    }

    @ApiOperation(value = "删除算法节点信息", httpMethod = "GET", notes= "删除算法节点信息", produces = "application/json;charset=utf-8", response=Map.class)
    @GetMapping(value = "/delete/{ids}", produces = { "application/json;charset=utf-8"})
    public Map<String, Object> delete(@PathVariable("ids") List<String> ids) {
        return algorithmBasicDataService.delete(ids);
    }
}
