package com.njcn.csdevice.controller.ledger;

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.CsLedgerVO;
import com.njcn.csdevice.service.IWlLedgerService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2024/4/9 14:42
 */
@RestController
@RequestMapping("/wlLedger")
@Slf4j
@Api(tags = "便携式终端台账")
@AllArgsConstructor
public class WlLedgerController extends BaseController {

    private final IWlLedgerService wlLedgerService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/wlDevice")
    @ApiOperation("设备列表")
    public HttpResult<List<CsLedgerVO>> getWlDevice(){
        String methodDescribe = getMethodDescribe("getWlDevice");
        List<CsLedgerVO> list = wlLedgerService.getWlDevice();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/wlDeviceTree")
    @ApiOperation("二层设备树(设备-监测点)")
    public HttpResult<List<CsLedgerVO>> getWlDeviceTree(){
        String methodDescribe = getMethodDescribe("getWlDeviceTree");
        List<CsLedgerVO> list = wlLedgerService.getWlDeviceTree();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

}
