package com.njcn.gather.steady.datavie.controller;

import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.LogUtil;
import com.njcn.gather.steady.datavie.pojo.vo.SteadyDataViewIndicatorNodeVO;
import com.njcn.gather.steady.datavie.service.SteadyDataViewIndicatorService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 稳态趋势指标接口。
 */
@Slf4j
@Api(tags = "稳态趋势指标")
@RestController
@RequestMapping("/steady/data-view")
@RequiredArgsConstructor
public class SteadyDataViewIndicatorController extends BaseController {

    private final SteadyDataViewIndicatorService indicatorService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询稳态趋势指标树")
    @GetMapping("/indicator-tree")
    public HttpResult<List<SteadyDataViewIndicatorNodeVO>> listIndicatorTree() {
        String methodDescribe = getMethodDescribe("listIndicatorTree");
        LogUtil.njcnDebug(log, "{}，开始查询稳态趋势指标树", methodDescribe);
        List<SteadyDataViewIndicatorNodeVO> result = indicatorService.listIndicatorTree();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
