package com.njcn.csharmonic.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.HttpResultUtil;
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
import com.njcn.csharmonic.service.ILineTargetService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2023/6/1 10:03
 */
@Slf4j
@RestController
@RequestMapping("/lineTarget")
@Api(tags = "组态指标绑定")
@AllArgsConstructor
public class LineTargetController extends BaseController {

    private final ILineTargetService lineTargetService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/target")
    @ApiOperation("监测点指标")
    @ApiImplicitParam(name = "lineId", value = "监测点Id", required = true)
    public HttpResult<List<DataArrayTreeVO>> getLineTarget(@RequestParam("lineId") String lineId) {
        String methodDescribe = getMethodDescribe("getLineTarget");
        List<DataArrayTreeVO> list = lineTargetService.getLineTarget(lineId);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

}
