package com.njcn.csdevice.controller.project;


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.param.CsUserPinsParam;
import com.njcn.csdevice.pojo.po.CsUserPins;
import com.njcn.csdevice.service.ICsUserPinsService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户置顶表 前端控制器
 * </p>
 *
 * @author xy
 * @since 2026-03-04
 */
@Slf4j
@RestController
@RequestMapping("/csUserPins")
@Api(tags = "置顶设备(工程)")
@AllArgsConstructor
public class CsUserPinsController extends BaseController {

    private final ICsUserPinsService csUserPinsService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/engineeringPinToTop")
    @ApiOperation("用户置顶工程(取消置顶)")
    public HttpResult<Boolean> engineeringPinToTop(@Validated @RequestBody CsUserPinsParam param){
        String methodDescribe = getMethodDescribe("engineeringPinToTop");
        Boolean result = csUserPinsService.engineeringPinToTop(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPinToTopList")
    @ApiOperation("获取用户置顶设备(工程)")
    public HttpResult<List<CsUserPins>> getPinToTopList(){
        String methodDescribe = getMethodDescribe("getPinToTopList");
        List<CsUserPins> result = csUserPinsService.getPinToTopList();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

}

